The difference in behavior comes down to the template rendering: with
`TabularInline` the field names are rendered separately from the values,
and so the label and help text are accessed differently. The
[https://github.com/django/django/blob/a38ae914d89809aed6d79337b74a8b31b6d3849a/django/contrib/admin/helpers.py#L264
code which provides them] never looks at `ModelForm._meta`, but
[https://github.com/django/django/blob/a38ae914d89809aed6d79337b74a8b31b6d3849a/django/contrib/admin/helpers.py#L167
code further up in the same file] does.
I'm attaching a crude patch against master which factors out the existing
logic and reuses it in both spots I linked. Discovered this issue while
trying to meet a deadline for a project so I don't have time to do a
proper PR or even run the tests. The patch works for my manual testing,
but your mileage may vary. It at least illustrates where the issue is and
a possible fix. **Note:** The patch does not keep the behavior in
`AdminReadonlyField` where it flips between using `class_name` and
`field`. No explanation is given in the code for why it alternates, and it
seems illogical to me, but maybe someone knows better. The patch simply
uses `class_name`.
--
Ticket URL: <https://code.djangoproject.com/ticket/29184>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* Attachment "tabularinline_label_and_help_text.patch" added.
* stage: Unreviewed => Accepted
* needs_tests: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/29184#comment:1>
* Attachment "tabularinline_label_and_help_text_2.patch" added.
Fixed patch
Comment (by David Sanders):
Tweaked the patch a little bit to fix a situation it broke with pure form
fields (no model field).
--
Ticket URL: <https://code.djangoproject.com/ticket/29184#comment:2>
* owner: nobody => Danil Kozyatnikov
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/29184#comment:3>
* needs_tests: 1 => 0
Comment:
[https://github.com/django/django/pull/9767 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/29184#comment:4>
* needs_better_patch: 0 => 1
Comment:
Overall patch in PR looks good.
Just a few adjustments needed (comments on PR). Please uncheck ''Patch
needs improvement'' when these are addressed.
Thanks Danil.
--
Ticket URL: <https://code.djangoproject.com/ticket/29184#comment:5>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"274e3e27f366bddbf1bb13b40c3c7b95195c496e" 274e3e2]:
{{{
#!CommitTicketReference repository=""
revision="274e3e27f366bddbf1bb13b40c3c7b95195c496e"
Fixed #29184 -- Made TabularInline respect model form's Meta.labels and
help_texts.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29184#comment:6>