#5863: list_display does not allow functions of referenced objects
-------------------------------------------------------+--------------------
Reporter: Beat Bolli <[email protected]> | Owner: nobody
Status: reopened | Milestone:
Component: django.contrib.admin | Version: SVN
Resolution: | Keywords:
list_display
Stage: Design decision needed | Has_patch: 1
Needs_docs: 1 | Needs_tests: 0
Needs_better_patch: 1 |
-------------------------------------------------------+--------------------
Comment (by ramiro):
I'd say this ticket can be closed (I found it when looking for material
related to #10230).
Using callables (bare functions for example, i.e. no model methods nor
`ModelAdmin` subclasses methods) make the "It violates DRY: I have to
define the same function on each model that references the foreign model"
argument moot.
Also, when it comes to the HTML table headers:
1. Seeing a bare 'Code' header (using the
[http://code.djangoproject.com/ticket/5863#comment:6 comment 6] example)
that refers to a `code` field of a `Client` model that is located one or
more FK-hops away isn't necessarily a good idea, it can be confusing
because the user could assume it refers about a (non-existent) `code`
field local to the model being displayed.
2. In the case of more that one level of indirection, having an
automatically-generated `'Hop1 Model > ... > HopN Model > Field'` header
wouldn´t be practical/scalable.
It's more practical in that case that the developer sets explicitely an
appropiate, unambiguous header literal using the `.short_description`
facility.
In other words, I'd say current functionality plus a bit of work satisfy
the needs expressed in this ticket discussion for this arguably rare
scenario.
--
Ticket URL: <http://code.djangoproject.com/ticket/5863#comment:18>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---