Author: jacob
Date: 2007-02-25 22:53:44 -0600 (Sun, 25 Feb 2007)
New Revision: 4591

Modified:
   django/trunk/django/views/generic/list_detail.py
   django/trunk/docs/generic_views.txt
Log:
Fixed #3170: added first_on_page and last_on_page arguments to paginated 
generic views. Thanks, Grimboy.

Modified: django/trunk/django/views/generic/list_detail.py
===================================================================
--- django/trunk/django/views/generic/list_detail.py    2007-02-26 04:37:52 UTC 
(rev 4590)
+++ django/trunk/django/views/generic/list_detail.py    2007-02-26 04:53:44 UTC 
(rev 4591)
@@ -33,6 +33,12 @@
             number of pages, total
         hits
             number of objects, total
+        last_on_page
+            the result number of the last of object in the
+            object_list (1-indexed)
+        first_on_page
+            the result number of the first object in the
+            object_list (1-indexed)
     """
     if extra_context is None: extra_context = {}
     queryset = queryset._clone()
@@ -57,6 +63,8 @@
             'page': page,
             'next': page + 1,
             'previous': page - 1,
+            'last_on_page': paginator.last_on_page(page - 1),
+            'first_on_page': paginator.first_on_page(page - 1),
             'pages': paginator.pages,
             'hits' : paginator.hits,
         }, context_processors)

Modified: django/trunk/docs/generic_views.txt
===================================================================
--- django/trunk/docs/generic_views.txt 2007-02-26 04:37:52 UTC (rev 4590)
+++ django/trunk/docs/generic_views.txt 2007-02-26 04:53:44 UTC (rev 4591)
@@ -752,6 +752,12 @@
 
     * ``previous``: The previous page number, as an integer. This is 1-based.
 
+    * `last_on_page`: **New in Django development version** The number of the
+      last result on the current page. This is 1-based.
+
+    * `first_on_page`: **New in Django development version** The number of the
+      first result on the current page. This is 1-based.
+
     * ``pages``: The total number of pages, as an integer.
 
     * ``hits``: The total number of objects across *all* pages, not just this


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to