Class-based generic views + pagination hard to understand
|Reported by:||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
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.)