Opened 13 years ago
Closed 12 years ago
#17050 closed New feature (fixed)
add id attribute to individual model divs in the admin index
Reported by: | scytale | Owned by: | thiderman |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | Normal | Keywords: | admin |
Cc: | vanessagomes | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | yes | UI/UX: | yes |
Description
A client has requested color coding in the admin index page to help staff identify sections relevant to particular departments. In order to facilitate this I would like to give id attributes to the individual divs that enclose each "module" (app) section in the index page.
Attachments (2)
Change History (16)
by , 13 years ago
Attachment: | index_div_id.diff added |
---|
comment:1 by , 13 years ago
Summary: | add id blah to individual msodel divs in the admin index → add id attribute to individual model divs in the admin index |
---|
comment:2 by , 13 years ago
Patch needs improvement: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:4 by , 13 years ago
Triage Stage: | Accepted → Unreviewed |
---|
by , 13 years ago
Attachment: | fix_index_div_id.diff added |
---|
comment:7 by , 12 years ago
Cc: | added |
---|---|
Owner: | changed from | to
comment:8 by , 12 years ago
Owner: | removed |
---|
comment:9 by , 12 years ago
Needs documentation: | set |
---|---|
Owner: | set to |
Patch needs improvement: | set |
I'll tackle this as part of my work on the Django sprint in Stockholm. I'll clean up the patch, make it apply to a current master and add some documentation to it!
comment:10 by , 12 years ago
Needs documentation: | unset |
---|---|
Patch needs improvement: | unset |
Pull request added: https://github.com/django/django/pull/535
I'll be honest; I'm not completely sure about the documentation I added. I followed jezdez' advice about splitting the "Overriding templates" part into a more general part about customization. Feedback on that part is especially welcome.
comment:11 by , 12 years ago
Patch needs improvement: | set |
---|
Thanks a lot for the patch. It looks pretty good. I have some minor comments:
- I don't think it's worth creating a separate test app for this (
admin_individual_ids
). Could you put those tests inadmin_views
instead? You might even be able to reuse existing models. - I'm not sure this is worth documenting at all. It's a really minor thing, and in the rare cases where developers might want to do this type of customization, they can easily inspect the DOM. So I recommend removing the doc from the patch.
comment:12 by , 12 years ago
I agree about the test app creation. I'll merge them into admin_views
and check for some of the existing models instead.
Should I leave the release note in or should I remove that as well?
comment:13 by , 12 years ago
Pull request updated: https://github.com/django/django/pull/535
I removed everything from the documentation, including the release note. I merged the tests into the admin_views
test and tested againt the first two generic models (Actor
and Album
). This made for a much cleaner patch!
comment:14 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
That sounds reasonable. Using slugify on the app's title would probably be error prone, so instead I'd simply pass the app_label through to the template and use that instead. Also, you'd need to prefix the id, for example with "app-", to be sure it doesn't conflict with other styles (e.g. if you have an app called "changelist").