Opened 14 years ago
Last modified 9 months ago
#15059 assigned Cleanup/optimization
Additional Documentation for the objects in the admin templates
Reported by: | mlakewood | Owned by: | Hassan Mian |
---|---|---|---|
Component: | Documentation | Version: | 1.2 |
Severity: | Normal | Keywords: | admin templates override |
Cc: | reinout@…, Caio Ariede, Ryan Cheley | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
Hi,
I've being trying to override the admin template for change_list for the last couple of days. As I was working through it the documentation was great up until the point where I needed to access some data that was being displayed on the page. After that I really struggled on how and where to get the data from. In the end somebody mentioned that I could do {{cl.get_query_set()}}, and then just by chance I worked out that you could do {{cl.result_list}} to get the filtered list.
It would be really helpful if in the documentation for over riding the admin templates there was an explanation of how to get at the data. As from my experience its one of the first things that I wanted to do to the admin interface.
Cheers
Change History (12)
comment:1 by , 14 years ago
Component: | Uncategorized → Documentation |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → Bug |
comment:3 by , 13 years ago
UI/UX: | unset |
---|
comment:5 by , 8 years ago
Cc: | added |
---|
I've looked at the 1.10 docs: the issue is still valid. There is some documentation on where to place which templates, but no documentation on the context that is available to the templates.
See https://docs.djangoproject.com/en/1.10/ref/contrib/admin/#overriding-admin-templates
Would a simple pointer at the code suffice?
comment:6 by , 5 years ago
Cc: | added |
---|
Would a simple pointer at the code suffice?
I really think that this deserves better documentation, specially because it's already been used by some pretty popular projects like django-grappelli, django-jet at al.
I'd say having these documented will help us formalize that the context sent to admin templates are stable and any changes should be stated in release notes and docs.
Perhaps we could add the context for each template list in Templates which may be overridden per app or model?
I'm not exactly sure about the formatting that could be used, but this is what I have in mind for now:
- change_list.html with the following context:
- module_name
- selection_note - text containing count of selected records (eg.
0 of %(cnt)s selected
) - selection_note_all - same as selection_note but with all records
- title - title of the page
- ...
comment:7 by , 2 years ago
Hi all,
(Please be aware that this is my first contribution, so any feedback is highly appreciated)
I've added some context variables for actions.html. Basically, gone through the variables that are being used in django's implementation of actions.html and tried to document them. I'm not sure if the format is as expected though.
If this is the way we want the document to be, I'd be happy to add the documentation for the rest of the admin templates as well.
comment:8 by , 9 months ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:9 by , 9 months ago
Has patch: | set |
---|
It looks like work done by Hassan may not have been seen because the Has Patch
flag wasn’t set. I’m setting it now so that the maintainers can review it and provide feedback
comment:10 by , 9 months ago
Patch needs improvement: | set |
---|---|
Type: | Bug → Cleanup/optimization |
comment:11 by , 9 months ago
Owner: | changed from | to
---|
comment:12 by , 9 months ago
Cc: | added |
---|
Change UI/UX from NULL to False.