Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #10898 -- Corrected minor error in conditional view processing …

…example. Thanks to Tomasz Elendt for the report.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10642 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 0c1d38bdf4884121e322c557e09721af85c10eb3 1 parent 6312de0
Russell Keith-Magee authored April 28, 2009
12  docs/topics/conditional-view-processing.txt
@@ -59,10 +59,10 @@ The ``condition`` decorator's signature looks like this::
59 59
 The two functions, to compute the ETag and the last modified time, will be
60 60
 passed the incoming ``request`` object and the same parameters, in the same
61 61
 order, as the view function they are helping to wrap. The function passed
62  
-``last_modified`` should return a standard datetime value specifying the last
63  
-time the resource was modified, or ``None`` if the resource doesn't exist. The
64  
-function passed to the ``etag`` decorator should return a string representing
65  
-the `Etag`_ for the resource, or ``None`` if it doesn't exist.
  62
+``last_modified_func`` should return a standard datetime value specifying the
  63
+last time the resource was modified, or ``None`` if the resource doesn't
  64
+exist. The function passed to the ``etag`` decorator should return a string
  65
+representing the `Etag`_ for the resource, or ``None`` if it doesn't exist.
66 66
 
67 67
 Using this feature usefully is probably best explained with an example.
68 68
 Suppose you have this pair of models, representing a simple blog system::
@@ -83,10 +83,8 @@ add a new blog entry, you can compute the last modified time very quickly. You
83 83
 need the latest ``published`` date for every entry associated with that blog.
84 84
 One way to do this would be::
85 85
 
86  
-    from django.db.models import Max
87  
-
88 86
     def latest_entry(request, blog_id):
89  
-        return Entry.objects.filter(blog=blog_id).aggregate(Max("published"))
  87
+        return Entry.objects.filter(blog=blog_id).latest("published").published
90 88
 
91 89
 You can then use this function to provide early detection of an unchanged page
92 90
 for your front page view::

0 notes on commit 0c1d38b

Please sign in to comment.
Something went wrong with that request. Please try again.