#19375: Class-based generic views + pagination hard to understand
--------------------------------------+--------------------
Reporter: vtbassmatt@… | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: 1.4
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+--------------------
The example template shown in the pagination section of the docs
([https://docs.djangoproject.com/en/1.4/topics/pagination/]) doesn't work
with class-based generic views (such as ListView). However, the
MultipleObjectMixins section ([https://docs.djangoproject.com/en/1.4/ref
/class-based-views/#multiple-object-mixins]) suggests reading the
pagination docs. I eventually figured out how to get it working thanks to
a StackOverflow entry, but it would be great if the Django docs gave the
correct information.
Concretely: If you set '''paginate_by''' in the constructor of ListView,
then you don't use ''context_object''.has_previous,
''context_object''.has_next, etc. Instead, you use
'''page_obj'''.has_previous, '''page_obj'''.has_next, etc. ('''page_obj'''
is brought into the global namespace on the template rather than being
represented by the context object.)
--
Ticket URL: <https://code.djangoproject.com/ticket/19375>
Django <https://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 https://groups.google.com/groups/opt_out.