Opened 15 years ago
Closed 15 years ago
#11848 closed (duplicate)
Hook to be able to customize changelist_view
Reported by: | Igor Sobreira | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | 1.1 |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Currently, the changelist_view uses self.queryset to display the list of objects instances. So, to customize what changelist will use, you need to customise self.queryset. The bad point is that change_view also uses self.queryset, and maybe you don't wan't do affect it.
For example: I have a list of Page objects, that could have subpages. The subpages are Pages too, but are not listed in changelist. But you should be able to edit subpages (since they are Page objects). I've attached an image of my admin with this use case.
If I customize self.queryset to hide subpages (in changelist view), I can't access subpages form (change view) anymore.
I've attached a patch fix this. Just creating a self.queryset_changelist hook. And changing ChangeList to use it. Now I can customize what changelist will show me, without affecting what I can edit.
Attachments (2)
Change History (3)
by , 15 years ago
Attachment: | Picture 2.png added |
---|
by , 15 years ago
Attachment: | queryset_changelist.patch added |
---|
comment:1 by , 15 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
#10761 is already open requesting this.