diff --git a/docs/overview.txt b/docs/overview.txt index 544a897ac6..75e324aa57 100644 --- a/docs/overview.txt +++ b/docs/overview.txt @@ -183,7 +183,7 @@ is a simple Python function. Each view gets passed a request object -- which contains request metadata -- and the values captured in the regex. For example, if a user requested the URL "/articles/2005/05/39323/", Django -would call the function ``myproject.news.views.article_detail(request, +would call the function ``mysite.news.views.article_detail(request, '2005', '05', '39323')``. Write your views @@ -199,7 +199,7 @@ and renders the template with the retrieved data. Here's an example view for def year_archive(request, year): a_list = Article.objects.filter(pub_date__year=year) - return render_to_response('news/year_archive.html', {'article_list': a_list}) + return render_to_response('news/year_archive.html', {'year': year, 'article_list': a_list}) This example uses Django's template system, which has several powerful features but strives to stay simple enough for non-programmers to use. @@ -219,13 +219,16 @@ might look like:: {% extends "base.html" %} - {% block title %}{{ article.headline }}{% endblock %} + {% block title %}Articles for {{ year }}{% endblock %} {% block content %} -

{{ article.headline }}

-

By {{ article.get_reporter.full_name }}

+

Articles for {{ year }}

+ + {% for article in article_list %} +

{{ article.headline }}

+

By {{ article.reporter.full_name }}

Published {{ article.pub_date|date:"F j, Y" }}

- {{ article.article }} + {% endfor %} {% endblock %} Variables are surrounded by double-curly braces. ``{{ article.headline }}``