Code

Ticket #11554: 11554.diff

File 11554.diff, 3.1 KB (added by ramiro, 5 years ago)

Patch for this ticket, applies cleanly to thr 1.0.x branch too.

Line 
1diff -r 636f020aaf8e docs/topics/generic-views.txt
2--- a/docs/topics/generic-views.txt     Sat Jul 25 02:29:41 2009 -0300
3+++ b/docs/topics/generic-views.txt     Sat Jul 25 20:40:17 2009 -0300
4@@ -150,7 +150,7 @@
5         publisher = models.ForeignKey(Publisher)
6         publication_date = models.DateField()
7 
8-To build a list page of all books, we'd use a URLconf along these lines::
9+To build a list page of all publishers, we'd use a URLconf along these lines::
10 
11     from django.conf.urls.defaults import *
12     from django.views.generic import list_detail
13@@ -176,7 +176,7 @@
14 .. highlightlang:: html+django
15 
16 This template will be rendered against a context containing a variable called
17-``object_list`` that contains all the book objects. A very simple template
18+``object_list`` that contains all the publisher objects. A very simple template
19 might look like the following::
20 
21     {% extends "base.html" %}
22@@ -217,7 +217,7 @@
23 You might have noticed that our sample publisher list template stores all the
24 books in a variable named ``object_list``. While this works just fine, it isn't
25 all that "friendly" to template authors: they have to "just know" that they're
26-dealing with books here. A better name for that variable would be
27+dealing with publishers here. A better name for that variable would be
28 ``publisher_list``; that variable's content is pretty obvious.
29 
30 We can change the name of that variable easily with the ``template_object_name``
31@@ -241,14 +241,14 @@
32 --------------------
33 
34 Often you simply need to present some extra information beyond that provided by
35-the generic view. For example, think of showing a list of all the other
36-publishers on each publisher detail page. The ``object_detail`` generic view
37-provides the publisher to the context, but it seems there's no way to get a list
38-of *all* publishers in that template.
39+the generic view. For example, think of showing a list of all the books on each
40+publisher detail page. The ``object_detail`` generic view provides the
41+publisher to the context, but it seems there's no way to get additional
42+information in that template.
43 
44 But there is: all generic views take an extra optional parameter,
45 ``extra_context``. This is a dictionary of extra objects that will be added to
46-the template's context. So, to provide the list of all publishers on the detail
47+the template's context. So, to provide the list of all books on the detail
48 detail view, we'd use an info dict like this:
49 
50 .. parsed-literal::
51@@ -268,9 +268,9 @@
52 However, there's actually a subtle bug here -- can you spot it?
53 
54 The problem has to do with when the queries in ``extra_context`` are evaluated.
55-Because this example puts ``Publisher.objects.all()`` in the URLconf, it will
56+Because this example puts ``Book.objects.all()`` in the URLconf, it will
57 be evaluated only once (when the URLconf is first loaded). Once you add or
58-remove publishers, you'll notice that the generic view doesn't reflect those
59+remove books, you'll notice that the generic view doesn't reflect those
60 changes until you reload the Web server (see :ref:`caching-and-querysets`
61 for more information about when QuerySets are cached and evaluated).
62