#4919: add ?page=last for generic object_list with pagination
--------------------------------------+-------------------------------------
Reporter: [EMAIL PROTECTED] | Owner: jacob
Status: new | Component: Generic views
Version: SVN | Keywords:
Stage: Unreviewed | Has_patch: 0
--------------------------------------+-------------------------------------
usecase: you want to link to the last page, but you don´t know how many
pages there are. e.g, when you have comments paginated and you want to
link to the last comment posted, you could use ?page=last
{{{
except (InvalidPage, ValueError):
if page == 1 and allow_empty:
object_list = []
+ elif page == 'last':
+ page = paginator._get_pages()
+ object_list = paginator.get_page(page - 1)
else:
raise Http404
}}}
sorry, but submitting a patch didn´t work the last time, so I just put the
code in here.
the above code-snippet is for django.views.generic.list_detail.object_list
from line 52.
--
Ticket URL: <http://code.djangoproject.com/ticket/4919>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---