[Django] #29184: TabularInline Read-only Fields Ignore ModelForm._meta Label and Help Text Overrides

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

[Django] #29184: TabularInline Read-only Fields Ignore ModelForm._meta Label and Help Text Overrides

Django
#29184: TabularInline Read-only Fields Ignore ModelForm._meta Label and Help Text
Overrides
-------------------------------------+-------------------------------------
               Reporter:  David      |          Owner:  nobody
  Sanders                            |
                   Type:  Bug        |         Status:  new
              Component:             |        Version:  2.0
  contrib.admin                      |       Keywords:  readonly,
               Severity:  Normal     |  help_texts, labels
           Triage Stage:             |      Has patch:  1
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 Providing a `ModelForm` for `admin.TabularInline` will have any
 `Meta.labels` or `Meta.help_texts` overrides for read-only fields ignored.
 This behavior is inconsistent with `ModelAdmin` and `admin.StackedInline`,
 which *do* respect those overrides.

 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.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/053.641df05c861d5de71982e9f0a276b96f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29184: TabularInline Read-only Fields Ignore ModelForm._meta Label and Help Text Overrides

Django
#29184: TabularInline Read-only Fields Ignore ModelForm._meta Label and Help Text
Overrides
-------------------------------------+-------------------------------------
     Reporter:  David Sanders        |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  contrib.admin        |                  Version:  2.0
     Severity:  Normal               |               Resolution:
     Keywords:  readonly,            |             Triage Stage:
  help_texts, labels                 |  Unreviewed
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by David Sanders):

 * Attachment "tabularinline_label_and_help_text.patch" added.


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

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/068.ed7a47c41d34d6ab50f3543deab9fef5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29184: TabularInline read-only fields ignore ModelForm Meta.labels and help_texts (was: TabularInline Read-only Fields Ignore ModelForm._meta Label and Help Text Overrides)

Django
In reply to this post by Django
#29184: TabularInline read-only fields ignore ModelForm Meta.labels and help_texts
-------------------------------------+-------------------------------------
     Reporter:  David Sanders        |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  contrib.admin        |                  Version:  2.0
     Severity:  Normal               |               Resolution:
     Keywords:  readonly,            |             Triage Stage:  Accepted
  help_texts, labels                 |
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  1                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

 * stage:  Unreviewed => Accepted
 * needs_tests:  0 => 1


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

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/068.354423aa08680294a974d5ee560e0d76%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29184: TabularInline read-only fields ignore ModelForm Meta.labels and help_texts

Django
In reply to this post by Django
#29184: TabularInline read-only fields ignore ModelForm Meta.labels and help_texts
-------------------------------------+-------------------------------------
     Reporter:  David Sanders        |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  contrib.admin        |                  Version:  2.0
     Severity:  Normal               |               Resolution:
     Keywords:  readonly,            |             Triage Stage:  Accepted
  help_texts, labels                 |
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  1                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by David Sanders):

 * Attachment "tabularinline_label_and_help_text_2.patch" added.

 Fixed patch

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

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/068.e0719c6292596ffe276ce2eb1d60e197%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29184: TabularInline read-only fields ignore ModelForm Meta.labels and help_texts

Django
In reply to this post by Django
#29184: TabularInline read-only fields ignore ModelForm Meta.labels and help_texts
-------------------------------------+-------------------------------------
     Reporter:  David Sanders        |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  contrib.admin        |                  Version:  2.0
     Severity:  Normal               |               Resolution:
     Keywords:  readonly,            |             Triage Stage:  Accepted
  help_texts, labels                 |
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  1                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

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>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/068.0303c8866ee3172678d7f017fbc7dcb9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29184: TabularInline read-only fields ignore ModelForm Meta.labels and help_texts

Django
In reply to this post by Django
#29184: TabularInline read-only fields ignore ModelForm Meta.labels and help_texts
-------------------------------------+-------------------------------------
     Reporter:  David Sanders        |                    Owner:  Danil
                                     |  Kozyatnikov
         Type:  Bug                  |                   Status:  assigned
    Component:  contrib.admin        |                  Version:  2.0
     Severity:  Normal               |               Resolution:
     Keywords:  readonly,            |             Triage Stage:  Accepted
  help_texts, labels                 |
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  1                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Danil Kozyatnikov):

 * owner:  nobody => Danil Kozyatnikov
 * status:  new => assigned


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

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/068.82f586429353f5e9a70183e19074a36b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29184: TabularInline read-only fields ignore ModelForm Meta.labels and help_texts

Django
In reply to this post by Django
#29184: TabularInline read-only fields ignore ModelForm Meta.labels and help_texts
-------------------------------------+-------------------------------------
     Reporter:  David Sanders        |                    Owner:  Danil
                                     |  Kozyatnikov
         Type:  Bug                  |                   Status:  assigned
    Component:  contrib.admin        |                  Version:  2.0
     Severity:  Normal               |               Resolution:
     Keywords:  readonly,            |             Triage Stage:  Accepted
  help_texts, labels                 |
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

 * needs_tests:  1 => 0


Comment:

 [https://github.com/django/django/pull/9767 PR]

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

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/068.355a0dd4d2357d5860f7112f3eb5d0bf%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29184: TabularInline read-only fields ignore ModelForm Meta.labels and help_texts

Django
In reply to this post by Django
#29184: TabularInline read-only fields ignore ModelForm Meta.labels and help_texts
-------------------------------------+-------------------------------------
     Reporter:  David Sanders        |                    Owner:  Danil
                                     |  Kozyatnikov
         Type:  Bug                  |                   Status:  assigned
    Component:  contrib.admin        |                  Version:  2.0
     Severity:  Normal               |               Resolution:
     Keywords:  readonly,            |             Triage Stage:  Accepted
  help_texts, labels                 |
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  1
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

 * 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>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/068.167b350d72d184fb0aa50b16851ebdee%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29184: TabularInline read-only fields ignore ModelForm Meta.labels and help_texts

Django
In reply to this post by Django
#29184: TabularInline read-only fields ignore ModelForm Meta.labels and help_texts
-------------------------------------+-------------------------------------
     Reporter:  David Sanders        |                    Owner:  Danil
                                     |  Kozyatnikov
         Type:  Bug                  |                   Status:  closed
    Component:  contrib.admin        |                  Version:  2.0
     Severity:  Normal               |               Resolution:  fixed
     Keywords:  readonly,            |             Triage Stage:  Accepted
  help_texts, labels                 |
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  1
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

 * 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>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/068.081975c822ad8978ea55d093649f3f02%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.