If `list_display` and `list_editable` are both lists with a single item,
and `list_display_links` is not set, then the `list_editable` won't have
any effect, because the field will be displayed as a link rather than a
form field. We already have admin checks for usage of list_editable, but
this case does not appear to be covered.
{{{
class CustomAdmin(admin.ModelAdmin):
list_display = ('status', )
list_editable = ('status',)
}}}
#22792 is a related ticket.
--
Ticket URL: <https://code.djangoproject.com/ticket/26229>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
When I get a chance, I will have a closer look at the code and try to work
out what the problem is .
At a first glance,
[https://github.com/django/django/blob/master/tests/modeladmin/tests.py#L1544
ListDisplayEditableTests] should have a test case similar to
test_list_display_same_as_list_editable, but with `list_display_links`
undefined. In that case, there should be a warning if the first item in
list_display is in list_editable.
--
Ticket URL: <https://code.djangoproject.com/ticket/26229#comment:1>
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/26229#comment:2>
* has_patch: 0 => 1
Comment:
I've opened a pull request
https://github.com/django/django/pull/6156/files
The two old unit tests from #22792 still pass following my changes, and I
have added an addition test. However, I found it a tricky problem to get
my head around, so I'm not 100% certain I got it correct. I've added
comments to the pull request to explain my reasoning.
--
Ticket URL: <https://code.djangoproject.com/ticket/26229#comment:3>
* needs_better_patch: 0 => 1
Comment:
Left a few comments for improvement.
--
Ticket URL: <https://code.djangoproject.com/ticket/26229#comment:4>
* needs_better_patch: 1 => 0
Comment:
Pull request updated as suggested.
--
Ticket URL: <https://code.djangoproject.com/ticket/26229#comment:5>
Comment (by alasdairnicol):
New pull request is https://github.com/django/django/pull/6223
--
Ticket URL: <https://code.djangoproject.com/ticket/26229#comment:6>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"65bd053f11d22bca529f1da895599796fa0f3ee1" 65bd053f]:
{{{
#!CommitTicketReference repository=""
revision="65bd053f11d22bca529f1da895599796fa0f3ee1"
Fixed #26229 -- Improved check for model admin check admin.E124
Refs #22792
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26229#comment:7>