Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#10705 closed (wontfix)

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

Reported by: Joshua Russo 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.

Change History (3)

comment:1 Changed 7 years ago by Alex Gaynor

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Resolution: wontfix
Status: newclosed

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 7 years ago by Joshua Russo

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 7 years ago by Alex Gaynor

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.

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