When a field is readonly, the `AdminReadonlyField` class ignores the form
overrides. Ideally the `AdminReadonlyField` should check first for the
overrides on `form._meta`, and fallback to the `label_for_field()` and
`help_text_for_field()` functions.
--
Ticket URL: <https://code.djangoproject.com/ticket/22087>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* cc: bendavis78 (added)
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/22087#comment:1>
* stage: Unreviewed => Accepted
Comment:
I think the ideal solution would be to get rid of custom logic in
`AdminReadonlyField` as much as possible, adding functionality to
`django.forms` as necessary.
--
Ticket URL: <https://code.djangoproject.com/ticket/22087#comment:2>
* has_patch: 0 => 1
Comment:
Hmm, I'm not sure how you could avoid custom logic in the
AdminReadonlyField for this. This bug is only relevant to the admin, which
already creates wrappers around every field. The bug is in the wrapper
itself, not with the forms.
At any rate, I've created a pull request for a fix, with tests. Let me
know what you think.
https://github.com/django/django/pull/2323
--
Ticket URL: <https://code.djangoproject.com/ticket/22087#comment:3>
Comment (by anonymous):
Has there been any update on this?
Thanks,
Dan
--
Ticket URL: <https://code.djangoproject.com/ticket/22087#comment:4>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"16afffffe87bf8b7de6403329937433ac5096697"]:
{{{
#!CommitTicketReference repository=""
revision="16afffffe87bf8b7de6403329937433ac5096697"
Fixed #22087 -- Made AdminReadonlyField respect ModelForm Meta overrides.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/22087#comment:5>
Comment (by Tim Graham <timograham@…>):
In [changeset:"24604844866a0b28122a1c47ac85072ea05b9b71"]:
{{{
#!CommitTicketReference repository=""
revision="24604844866a0b28122a1c47ac85072ea05b9b71"
[1.7.x] Fixed #22087 -- Made AdminReadonlyField respect ModelForm Meta
overrides.
Backport of 16afffffe8 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/22087#comment:6>
Comment (by timo):
We could backport the fix to 1.6.x as it's a bug in a new feature, but I
haven't done so because there were several conflicts. Feel free to send a
PR for that along with a note in the 1.6.3 release notes if you'd like.
--
Ticket URL: <https://code.djangoproject.com/ticket/22087#comment:7>