Opened 10 years ago

Last modified 9 months ago

#15059 new Bug

Additional Documentation for the objects in the admin templates

Reported by: mlakewood Owned by: nobody
Component: Documentation Version: 1.2
Severity: Normal Keywords: admin templates override
Cc: reinout@…, Caio Ariede Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
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 (6)

comment:1 Changed 10 years ago by Russell Keith-Magee

Component: UncategorizedDocumentation
Triage Stage: UnreviewedAccepted

comment:2 Changed 9 years ago by anonymous

Severity: Normal
Type: Bug

comment:3 Changed 8 years ago by Aymeric Augustin

UI/UX: unset

Change UI/UX from NULL to False.

comment:4 Changed 8 years ago by Aymeric Augustin

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:5 Changed 4 years ago by Reinout van Rees

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 4 years ago by Reinout van Rees (previous) (diff)

comment:6 Changed 9 months ago by Caio Ariede

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
    • ...
Note: See TracTickets for help on using tickets.
Back to Top