* status: new => closed
* resolution: => wontfix
Comment:
If I understand correctly, the goal of this ticket is to enable Django to
automatically optimize the queryset for building the admin changelist by
adding appropriate fields to select_related() and only().
But that can't be done automatically as soon as someone puts a callable in
`display_list`. So we're back to square 1, except Django pretended that it
could handle the optimization automatically, and failed at that.
In my opinion that would be worse that just telling the user to write an
appropriate get_queryset. For this reason (and also considering limited
demand for this feature over the last five years) I'm going to reject this
ticket.
--
Ticket URL: <https://code.djangoproject.com/ticket/10743#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: closed => new
* resolution: wontfix =>
Comment:
I'm going to reopen this ticket because I disagree with my 19-month-ago-
former-self.
My present-day-self keeps trying to write:
{{{
list_display = ['foo__bar']
}}}
and being mad at Django that it doesn't work.
We could limit that syntax to relation fields and not support calling
methods on the target model if that helps. It would still solve 95% of the
problem.
--
Ticket URL: <https://code.djangoproject.com/ticket/10743#comment:5>
* cc: zachborboa@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/10743#comment:6>
* cc: olivier.dalang@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/10743#comment:7>
Comment (by Ofer Nave):
I'm eager to have this, and am surprised that it hasn't happened after 13
years.
In the meantime, I'm relying on this very small package which implements a
version of this feature:
https://github.com/PetrDlouhy/django-related-admin/
--
Ticket URL: <https://code.djangoproject.com/ticket/10743#comment:8>
* cc: Ofer Nave (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/10743#comment:9>
* cc: Adam Johnson (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/10743#comment:10>
* cc: Egor R (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/10743#comment:11>
* needs_docs: 1 => 0
* needs_tests: 1 => 0
Comment:
[https://github.com/django/django/pull/16726 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/10743#comment:12>
* owner: nobody => Alex Garcia Ruiz de Oteiza
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/10743#comment:13>
* needs_better_patch: 0 => 1
* needs_tests: 0 => 1
* needs_docs: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/10743#comment:14>
* owner: Alex Garcia Ruiz de Oteiza => Tom Carrick
Comment:
I made a new PR from the old one.
[https://github.com/django/django/pull/17357 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/10743#comment:15>
* needs_better_patch: 1 => 0
* needs_tests: 1 => 0
* needs_docs: 1 => 0
Comment:
Resetting patch flags so it gets shown in the review queue.
--
Ticket URL: <https://code.djangoproject.com/ticket/10743#comment:16>
* needs_better_patch: 0 => 1
* needs_tests: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/10743#comment:17>
* needs_better_patch: 1 => 0
* needs_tests: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/10743#comment:18>
* needs_better_patch: 0 => 1
Comment:
Marking as needs improvement per Natalia's
[https://github.com/django/django/pull/17357#issuecomment-1779734651
comment].
--
Ticket URL: <https://code.djangoproject.com/ticket/10743#comment:19>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/10743#comment:20>
* needs_better_patch: 0 => 1
* needs_tests: 0 => 1
Comment:
Setting as patch needs improvement following
[https://github.com/django/django/pull/17357#issuecomment-1881676716 this
PR comment] stating that selenium test would be needed for the list
display column ordering.
--
Ticket URL: <https://code.djangoproject.com/ticket/10743#comment:21>
Selenium test was added and it looks great, I just suggested two unit
tests for the changes in the admin's utils module. Leaving flags as they
are.
--
Ticket URL: <https://code.djangoproject.com/ticket/10743#comment:22>
* cc: Nina Menezes (added)
* needs_better_patch: 1 => 0
* needs_tests: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/10743#comment:23>
* cc: Tom Carrick (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/10743#comment:24>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/10743#comment:25>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"4ade8386ebfeb7a781dc2b62542c1cf5f8b9ddaf" 4ade8386]:
{{{#!CommitTicketReference repository=""
revision="4ade8386ebfeb7a781dc2b62542c1cf5f8b9ddaf"
Fixed #10743 -- Allowed lookups for related fields in
ModelAdmin.list_display.
Co-authored-by: Alex Garcia <m...@alexoteiza.com>
Co-authored-by: Natalia <124304+...@users.noreply.github.com>
Co-authored-by: Nina Menezes <https://github.com/nmenezes0>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/10743#comment:26>
In [changeset:"9cefdfc43f0bae696b56fa5a0bf22346f85affff" 9cefdfc]:
{{{#!CommitTicketReference repository=""
revision="9cefdfc43f0bae696b56fa5a0bf22346f85affff"
Refs #10743 -- Enabled ordering for lookups in ModelAdmin.list_display.
Co-authored-by: Natalia <124304+...@users.noreply.github.com>
Co-authored-by: Nina Menezes <https://github.com/nmenezes0>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/10743#comment:27>
In [changeset:"3e820d10f81ea9d0576633734c2ebd2621575cbe" 3e820d10]:
{{{#!CommitTicketReference repository=""
revision="3e820d10f81ea9d0576633734c2ebd2621575cbe"
Refs #10743 -- Removed leftover comment in
tests/admin_changelist/tests.py.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/10743#comment:28>