Opened 5 months ago

Closed 5 months ago

#36359 closed Bug (invalid)

id_for_label undefined for AdminReadonlyField

Reported by: Marc Sommerhalder Owned by:
Component: contrib.admin Version: 5.2
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

AdminReadonlyField does not define id_for_label (here) but uses it when help_text is present (here).

Change History (1)

comment:1 by Natalia Bidart, 5 months ago

Resolution: invalid
Status: newclosed

Hello Marc Sommerhalder, thanks for taking the time to report this and for referencing the relevant code.

You're correct that AdminReadonlyField does not define id_for_label. However, from what I can see, it's only accessed conditionally (i.e. only if it's already defined) so there doesn’t appear to be any resulting error or broken behavior in the admin output:

{% if field.field.id_for_label %} id="{{ field.field.id_for_label }}_helptext"{% endif %}

To better understand the problem you're experiencing, could you clarify what concrete issue you're observing in practice? For example, is there a traceback, rendering problem, or integration issue that this is causing? That would help determine whether this needs a code change or if the current behavior is acceptable.

I'll close as invalid for now but please reopen if you can provide further details (ideally a test case failing or a small Django test project to reproduce the error or the issue you are getting). You can also reach out in the Django Forum for further assistance

Note: See TracTickets for help on using tickets.
Back to Top