Opened 5 years ago

Closed 4 years ago

#14291 closed (duplicate)

In django admin results list, provide the field name as a css class on the table cell

Reported by: vjimw Owned by: nobody
Component: Contrib apps Version: 1.2
Severity: Keywords: admin css class field
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I have found it useful a number of times to use jQuery or other methods to directly reference a piece of content in an admin list. This would be much easier if I could address each table cell by the field name with a CSS class. I have modified the admin_list.py file and attached a patch.

Here is an example of an updated table row the field names as the CSS class on each cell.

<tr class="row1">
  <td class="action_checkbox"><input type="checkbox" class="action-select" value="13106" name="_selected_action" /></td>
  <th class="offer_code"><a href="13106/">CJTAKE10</a></th>
  <td class="legal_site">DealsPl.us</td>
  <td class="created_by">User: medv12 (Medv12 Legal)</td>
  <td class="copyright_or_trademark">CP</td><td class="store">Halloween Express</td>
  <td class="current_state">Found - 2010-09-14</td><td class="overdue">(None)</td>
</tr>

By adding the CSS class, I can easily extend the admin functionality with Javascript (or a JS library)

Attachments (1)

admin_list.py.patch (3.9 KB) - added by vjimw 5 years ago.
admin_list.py patch to add CSS classes for each table cell based on the file field

Download all attachments as: .zip

Change History (3)

Changed 5 years ago by vjimw

admin_list.py patch to add CSS classes for each table cell based on the file field

comment:1 Changed 4 years ago by dmoisset

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 4 years ago by julien

  • Resolution set to duplicate
  • Status changed from new to closed

Dupe of #11195.

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