Pass paginator object in generic view's context instead of several variables related to the paginator
|Reported by:||Owned by:||nobody|
|Cc:||Triage Stage:||Design decision needed|
|Has patch:||yes||Needs documentation:||yes|
|Needs tests:||yes||Patch needs improvement:||yes|
Currently, there is only one generic view with pagination capabilities (
object_list), but it is being asked for in the date-based generic views (#2367). I propose that instead of passing 11 different context variables related to pagination, that we pass just the paginator object and let the templates use what they need.
This would provide the following benefits:
- Paginator methods would only be called when needed instead of called to fill the 11 different context variables that might not get used in the template anyway.
- We are not repeating ourselves in the generic views. Instead of 11 context variables for each of the generic views and documentation of each, we have just one variable and have a Paginator documentation page that the generic view documentation sections could link to.
- Future enhancements would not require context variable and documentation changes for each generic view. They keep passing the paginator object as a whole.
Change History (12)
comment:1 Changed 9 years ago by
|Patch needs improvement:||unset|
|Triage Stage:||Unreviewed → Design decision needed|