Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Customizing Django Templates Template Tags and Filters Lengths and Counts

Not able to pass this challenge

Finally, list all of the flavors of ice cream in the unordered list below. Use either a for tag to list all the flavors in <li> tags or the unordered_list filter.

ice_cream/templates/ice_cream/list.html
<html>
    <head>
        <title>Ice Cream</title>
    </head>
    <body>

        <div>We have {{ flavors.count }} flavors today.</div>

        <ul>
          {% for flavor in flavors %}
            <li>{{flavor}}</li>
          {% end for %}
        </ul>

    </body>
</html>

2 Answers

Alexandra Barnett
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Alexandra Barnett
Front End Web Development Techdegree Graduate 46,473 Points

Hi Pabba! You were almost there! The end for at to end the for loop shouldn't have a space between the 'end' and the 'for':

<html>
    <head>
        <title>Ice Cream</title>
    </head>
    <body>

        <div>We have {{ flavors.count }} flavors today.</div>

        <ul>
          {% for flavor in flavors %}
            <li>{{flavor}}</li>
          {% endfor %}
        </ul>

    </body>
</html>

Let me know if you have any questions :)

Do you know how to use the unordered_list filter alternative?

Andrew Furzer
seal-mask
.a{fill-rule:evenodd;}techdegree
Andrew Furzer
Python Web Development Techdegree Student 7,364 Points

Similar to the filter for linebreaks creating paragraphs, using the filter |unordered_list is the alternative method.

In this case it would be {{ flavors|unordered_list }}.