Opened 8 years ago
Closed 8 years ago
#28496 closed Cleanup/optimization (fixed)
Add ModelAdmin.get_changelist_instance()
Description ¶
As requested/discussed in https://github.com/django/django/pull/8856
It is sometimes necessary to access the filtered/searched QuerySet generated by the current request parameters outside of the changelist_view
. For example, when exporting the current queryset in a custom view. In the current implementation, this cannot be achieved in a DRY fashion. Extracting the ChangeList
instantiation into its own method allows this DRY reuse.
This also allows the test code to utilise consistent/DRY instantiation of ChangeList
objects in place of the current hacks such as admin_changelist.tests.get_changelist_args
-- see new pull request.
Change History (3)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
Summary: | ChangeList instantiation code buried in ModelAdmin.changelist_view is not reusable → Add ModelAdmin.get_changelist_instance() |
---|---|
Triage Stage: | Unreviewed → Ready for checkin |
https://github.com/django/django/pull/8903