MultipleObjectMixin should handle pagination prior to get_context_data
|Reported by:||AndrewIngram||Owned by:||nobody|
|Cc:||AndrewIngram||Triage Stage:||Design decision needed|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The current implementation of MultipleObjectMixin performs all its pagination operations as part of get_context_data. Some views might require knowledge of pagination earlier in the process, for example a ModelFormSetView I've implemented needs to know about the pagination at the point it instantiates the FormSet, which happens before get_context_data is called.
At the moment we set self.object_list to the result of self.get_queryset(), I am wondering whether self.object_list should actually be the paginated result, and we can store the unpaginated queryset (unevaluated because we won't usually need it) as self.original_object_list (or something nicer) which would also be available in the context data.
I'm concerned that any changes to accomodate this requirement might affect the API of MultipleObjectMixin in a backwards-incompatible way, so I'd like to get feedback from the core devs as to what the right way to tackle this is.
Change History (3)
comment:1 Changed 4 years ago by aaugustin
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Design decision needed