Opened 12 years ago

Closed 11 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)

index_div_id.diff (737 bytes ) - added by scytale 12 years ago.
fix_index_div_id.diff (4.3 KB ) - added by H0ff1 12 years ago.

Download all attachments as: .zip

Change History (16)

by scytale, 12 years ago

Attachment: index_div_id.diff added

comment:1 by scytale, 12 years ago

Summary: add id blah to individual msodel divs in the admin indexadd id attribute to individual model divs in the admin index

comment:2 by Julien Phalip, 12 years ago

Patch needs improvement: set
Triage Stage: UnreviewedAccepted

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").

comment:3 by H0ff1, 12 years ago

Patch needs improvement: unset

I fixed it and added a Unit-Test

comment:4 by anonymous, 12 years ago

Triage Stage: AcceptedUnreviewed

comment:5 by Aymeric Augustin, 12 years ago

Triage Stage: UnreviewedAccepted

Revert spam.

by H0ff1, 12 years ago

Attachment: fix_index_div_id.diff added

comment:6 by H0ff1, 12 years ago

Made some CodeStyle fixes on the patch

comment:7 by vanessagomes, 12 years ago

Cc: vanessagomes added
Owner: changed from nobody to vanessagomes

comment:8 by vanessagomes, 12 years ago

Owner: vanessagomes removed

comment:9 by thiderman, 11 years ago

Needs documentation: set
Owner: set to thiderman
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 thiderman, 11 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 Julien Phalip, 11 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 in admin_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 thiderman, 11 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 thiderman, 11 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 Julien Phalip <jphalip@…>, 11 years ago

Resolution: fixed
Status: newclosed

In 2e2c4968f6b9b57354af7229687d179941ed74c5:

Fixed #17050 -- Added some CSS class names to the admin index pages to facilitate per-app or per-model style customizations. Thanks to scytale for the report and to H0ff1 and thiderman for their work on the patch.

Note: See TracTickets for help on using tickets.
Back to Top