[Django] #21902: Document search order for list_display

45 views
Skip to first unread message

Django

unread,
Jan 29, 2014, 11:18:45 AM1/29/14
to django-...@googlegroups.com
#21902: Document search order for list_display
-------------------------------+--------------------
Reporter: schrinaw@… | Owner: nobody
Type: Uncategorized | Status: new
Component: Documentation | Version: 1.5
Severity: Normal | Keywords: admin
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
Suppose I have a ModelAdmin with `list_display =
["some","model","fields"]` but then I also want to override how one of
those fields is displayed, so I create a method on the ModelAdmin Class
{{{
def some(self, obj):
return "blah"
}}}

It seems the model field takes precedence over the method on the
ModelAdmin, and I don't see "blah" returned in the changelist. This is
not clear from the documentation. (I figured I would be able to override
it).

On a related note, I think it makes sense to be able to override it in the
ModelAdmin.

--
Ticket URL: <https://code.djangoproject.com/ticket/21902>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 29, 2014, 1:13:39 PM1/29/14
to django-...@googlegroups.com
#21902: Document search order for list_display
-------------------------------+------------------------------------

Reporter: schrinaw@… | Owner: nobody
Type: Uncategorized | Status: new
Component: Documentation | Version: 1.5
Severity: Normal | Resolution:
Keywords: admin | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by bmispelon):

* needs_docs: => 0
* needs_better_patch: => 0
* needs_tests: => 0
* easy: 0 => 1
* stage: Unreviewed => Accepted


Comment:

Hi,

As described in the documentation [1], you can pass four different kinds
of values for `list_display`.

However, what that section doesn't say is that the given list is actually
the order in which Django tries each possibility.

I agree that it'd be useful to amend the documentation to mention
explicitly that the order of the list is the one Django uses.


As for the feature you're proposing, I don't see much value in it, for two
reasons:
1) It's already possible to override a field's display by defining a
method on the `ModelAdmin` you just need to give it a different name
2) Backwards-compatibility would be tricky


So I'm marking this ticket as `accepted` for the documentation issue
(which should be fairly trivial to fix), but I'm -0 on the proposed
change.

Thanks.

[1]
https://docs.djangoproject.com/en/1.6/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display

--
Ticket URL: <https://code.djangoproject.com/ticket/21902#comment:1>

Django

unread,
Feb 8, 2014, 3:39:29 PM2/8/14
to django-...@googlegroups.com
#21902: Document search order for list_display
--------------------------------------+------------------------------------
Reporter: schrinaw@… | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: 1.5

Severity: Normal | Resolution:
Keywords: admin | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by aaugustin):

* type: Uncategorized => Cleanup/optimization


--
Ticket URL: <https://code.djangoproject.com/ticket/21902#comment:2>

Django

unread,
Feb 22, 2014, 8:35:26 AM2/22/14
to django-...@googlegroups.com
#21902: Document search order for list_display
--------------------------------------+------------------------------------
Reporter: schrinaw@… | Owner: kobuz
Type: Cleanup/optimization | Status: assigned
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: admin nlsprint14 | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by kobuz):

* owner: nobody => kobuz
* status: new => assigned
* version: 1.5 => master
* cc: kobuz (added)
* keywords: admin => admin nlsprint14


--
Ticket URL: <https://code.djangoproject.com/ticket/21902#comment:3>

Django

unread,
Feb 22, 2014, 9:33:21 AM2/22/14
to django-...@googlegroups.com
#21902: Document search order for list_display
--------------------------------------+------------------------------------
Reporter: schrinaw@… | Owner: kobuz
Type: Cleanup/optimization | Status: assigned
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: admin nlsprint14 | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by kobuz):

PR for this https://github.com/django/django/pull/2347

--
Ticket URL: <https://code.djangoproject.com/ticket/21902#comment:4>

Django

unread,
Feb 22, 2014, 10:51:19 AM2/22/14
to django-...@googlegroups.com
#21902: Document search order for list_display
-------------------------------------+-------------------------------------
Reporter: schrinaw@… | Owner: kobuz
Type: | Status: assigned
Cleanup/optimization | Version: master
Component: Documentation | Resolution:
Severity: Normal | Triage Stage: Ready for
Keywords: admin nlsprint14 | checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by erikr):

* cc: eromijn@… (added)
* has_patch: 0 => 1
* stage: Accepted => Ready for checkin


Comment:

Patch looks good to me :)

--
Ticket URL: <https://code.djangoproject.com/ticket/21902#comment:5>

Django

unread,
Feb 22, 2014, 12:12:13 PM2/22/14
to django-...@googlegroups.com
#21902: Document search order for list_display
-------------------------------------+-------------------------------------
Reporter: schrinaw@… | Owner: kobuz
Type: | Status: closed
Cleanup/optimization | Version: master
Component: Documentation | Resolution: fixed

Severity: Normal | Triage Stage: Ready for
Keywords: admin nlsprint14 | checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Baptiste Mispelon <bmispelon@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"09b725f51bbfa0f01b27ee2d718889926d409519"]:
{{{
#!CommitTicketReference repository=""
revision="09b725f51bbfa0f01b27ee2d718889926d409519"
Fixed #21902 -- Documented search order for list_display.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/21902#comment:6>

Django

unread,
Feb 23, 2014, 8:01:39 AM2/23/14
to django-...@googlegroups.com
#21902: Document search order for list_display
-------------------------------------+-------------------------------------
Reporter: schrinaw@… | Owner: kobuz
Type: | Status: closed
Cleanup/optimization | Version: master
Component: Documentation | Resolution: fixed
Severity: Normal | Triage Stage: Ready for
Keywords: admin nlsprint14 | checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Baptiste Mispelon <bmispelon@…>):

In [changeset:"98070b94a9bbb8e915e724c4d23933bd3b243b3c"]:
{{{
#!CommitTicketReference repository=""
revision="98070b94a9bbb8e915e724c4d23933bd3b243b3c"
[1.6.x] Fixed #21902 -- Documented search order for list_display.

Backport of 09b725f51bbfa0f01b27ee2d718889926d409519 from master.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/21902#comment:7>

Reply all
Reply to author
Forward
0 new messages