Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Django Basics Django Templates Override a block

Calum Devitt
Calum Devitt
3,763 Points

Now put the existing contents of article_list.html, the {% for %} loop, into the block "content".

Im stuck i really have no idea what its asking me to do.

articles/templates/articles/article_list.html
{% extends "base.html" %}
{% for %}
{% for article in articles %}
{{article.headline}} 
{% endfor %}
Douglas North
Douglas North
10,884 Points

The endfor is associated with the '{% for article in articles %}' line, so you do not need the first {% for %}

2 Answers

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,454 Points

What the challenge is asking you to wrap the existing for loop with a block tag that is named "content". This means adding the start block tag before the {% for .... %} and adding an endblock tag after the {% endfor %}.

The start block tag would be {% block content %} and the end block tag would be {% endblock %}

{% extends "base.html" %}

beginning tag content block

{% block content %}

beginning tag for loop

{% for article in articles %}

{{articles.headline}}

end tag for loop

{% endfor %}

endtag content block

{% endblock content %}