Opened 14 years ago

Last modified 8 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 Russell Keith-Magee, 14 years ago

Component: UncategorizedDocumentation
Triage Stage: UnreviewedAccepted

comment:2 by anonymous, 14 years ago

Severity: Normal
Type: Bug

comment:3 by Aymeric Augustin, 13 years ago

UI/UX: unset

Change UI/UX from NULL to False.

comment:4 by Aymeric Augustin, 13 years ago

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:5 by Reinout van Rees, 8 years ago

Cc: reinout@… 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?

Last edited 8 years ago by Reinout van Rees (previous) (diff)

comment:6 by Caio Ariede, 5 years ago

Cc: Caio Ariede 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 Hassan Mian, 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.

Version 0, edited 2 years ago by Hassan Mian (next)

comment:8 by Ryan Cheley, 8 months ago

Owner: changed from nobody to Ryan Cheley
Status: newassigned

comment:9 by Ryan Cheley, 8 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 Mariusz Felisiak, 8 months ago

Patch needs improvement: set
Type: BugCleanup/optimization

comment:11 by Mariusz Felisiak, 8 months ago

Owner: changed from Ryan Cheley to Hassan Mian

comment:12 by Ryan Cheley, 8 months ago

Cc: Ryan Cheley added
Note: See TracTickets for help on using tickets.
Back to Top