Code

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#10705 closed (wontfix)

Admin_list.py - Items_for_result() hardcoding field type formating is ugly

Reported by: Rupe Owned by: nobody
Component: contrib.admin Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The logic for setting the result_repr value (in django\contrib\admin\templatetags\admin_list.py) should be moved to respective Field classes. The base Field class should have a format method to be overridden. I was adding an international currency Field and would be able to put everything in a utils library outside of Django if this were changed.

Attachments (0)

Change History (3)

comment:1 follow-up: Changed 5 years ago by Alex

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

Marking as wontfix, the admin is separate from django.db.* quite intentionally, the idea is to sever that dependency as completely as possible, not increase it.

comment:2 in reply to: ↑ 1 Changed 5 years ago by Rupe

Replying to Alex:

Marking as wontfix, the admin is separate from django.db.* quite intentionally, the idea is to sever that dependency as completely as possible, not increase it.

You wouldn't be putting admin functionality in the django.db.*. A shortcut for formatted output is something that would be nice to have in general and then the admin_list.py could just also make use of it, and there's no reason exceptions couldn't still be held in the admin_list.py.

comment:3 Changed 5 years ago by Alex

Except this won't save any code within Django, because(for example) BooealnField.format() couldn't actually return what the admin uses since that would be making all sorts of assumptions we don't want to be making.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.