#35755: Help text for hidden fields is visible in admin fieldsets
--------------------------------+------------------------------------
     Reporter:  Richard Laager  |                    Owner:  (none)
         Type:  Bug             |                   Status:  new
    Component:  contrib.admin   |                  Version:  4.2
     Severity:  Normal          |               Resolution:
     Keywords:                  |             Triage Stage:  Accepted
    Has patch:  0               |      Needs documentation:  0
  Needs tests:  0               |  Patch needs improvement:  0
Easy pickings:  1               |                    UI/UX:  1
--------------------------------+------------------------------------
Changes (by Sarah Boyce):

 * cc: Tom Carrick (added)
 * has_patch:  1 => 0
 * stage:  Unreviewed => Accepted
 * summary:  Regression: Help text for hidden fields shows => Help text for
     hidden fields is visible in admin fieldsets
 * ui_ux:  0 => 1

Comment:

 Thank you Richard! Would you like to prepare a PR?

 On what is the "right" way to fix it, I think either approach works, I
 would perhaps add the "hidden" class.

 As a rough idea of a regression test, something like this might work
 (depending on the approach):
 {{{#!diff
 --- a/tests/admin_inlines/models.py
 +++ b/tests/admin_inlines/models.py
 @@ -332,7 +332,7 @@ class SomeParentModel(models.Model):

  class SomeChildModel(models.Model):
      name = models.CharField(max_length=1)
 -    position = models.PositiveIntegerField()
 +    position = models.PositiveIntegerField(help_text="Position
 help_text.")
      parent = models.ForeignKey(SomeParentModel, models.CASCADE)
      readonly_field = models.CharField(max_length=1)

 diff --git a/tests/admin_inlines/tests.py b/tests/admin_inlines/tests.py
 index cba8db83d7..d74d6cbf04 100644
 --- a/tests/admin_inlines/tests.py
 +++ b/tests/admin_inlines/tests.py
 @@ -383,9 +383,7 @@ class TestInline(TestDataMixin, TestCase):
              response.rendered_content,
          )
          self.assertInHTML(
 -            '<div class="flex-container fieldBox field-position hidden">'
 -            '<label class="inline">Position:</label>'
 -            '<div class="readonly">1</div></div>',
 +            '<div class="help hidden"><div>Position
 help_text.</div></div>',
              response.rendered_content,
          )
 }}}
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35755#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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070191e5041eff-c91ac98f-22c7-4ab1-8392-3674111b90a5-000000%40eu-central-1.amazonses.com.

Reply via email to