diff options
| author | Luke Plant <L.Plant.98@cantab.net> | 2009-09-11 13:46:56 +0000 |
|---|---|---|
| committer | Luke Plant <L.Plant.98@cantab.net> | 2009-09-11 13:46:56 +0000 |
| commit | 8da58e51ff117ffe209cefbd3a5f008dd163bec4 (patch) | |
| tree | c47494464c044b5c89635ad803cc3ba2ce4209e4 | |
| parent | 7c53c2618d7dd9f04f309d195835e6abfc7e0e52 (diff) | |
Fixed #11554: Several errors in Generic Views Documentation.
Thanks Ramiro.
Refs #11477 - that ticket should have been marked a duplicate of #11554
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11499 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | docs/topics/generic-views.txt | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/docs/topics/generic-views.txt b/docs/topics/generic-views.txt index beadc37a1d..e4094ac000 100644 --- a/docs/topics/generic-views.txt +++ b/docs/topics/generic-views.txt @@ -150,7 +150,7 @@ be using these models:: publisher = models.ForeignKey(Publisher) publication_date = models.DateField() -To build a list page of all books, we'd use a URLconf along these lines:: +To build a list page of all publishers, we'd use a URLconf along these lines:: from django.conf.urls.defaults import * from django.views.generic import list_detail @@ -176,7 +176,7 @@ version of the model's name. .. highlightlang:: html+django This template will be rendered against a context containing a variable called -``object_list`` that contains all the book objects. A very simple template +``object_list`` that contains all the publisher objects. A very simple template might look like the following:: {% extends "base.html" %} @@ -217,7 +217,7 @@ Making "friendly" template contexts You might have noticed that our sample publisher list template stores all the books in a variable named ``object_list``. While this works just fine, it isn't all that "friendly" to template authors: they have to "just know" that they're -dealing with books here. A better name for that variable would be +dealing with publishers here. A better name for that variable would be ``publisher_list``; that variable's content is pretty obvious. We can change the name of that variable easily with the ``template_object_name`` @@ -241,14 +241,14 @@ Adding extra context -------------------- Often you simply need to present some extra information beyond that provided by -the generic view. For example, think of showing a list of all the other -publishers on each publisher detail page. The ``object_detail`` generic view -provides the publisher to the context, but it seems there's no way to get a list -of *all* publishers in that template. +the generic view. For example, think of showing a list of all the books on each +publisher detail page. The ``object_detail`` generic view provides the +publisher to the context, but it seems there's no way to get additional +information in that template. But there is: all generic views take an extra optional parameter, ``extra_context``. This is a dictionary of extra objects that will be added to -the template's context. So, to provide the list of all publishers on the detail +the template's context. So, to provide the list of all books on the detail detail view, we'd use an info dict like this: .. parsed-literal:: |
