Re: [Django] #35755: Help text for hidden fields is visible in admin fieldsets (was: Regression: Help text for hidden fields shows)

3 views
Skip to first unread message

Django

unread,
Sep 12, 2024, 2:55:44 AM9/12/24
to django-...@googlegroups.com
#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.
Reply all
Reply to author
Forward
0 new messages