Opened 18 months ago

Last modified 8 weeks ago

#34624 assigned Bug

RelatedFieldWidgetWrapper links toggling isn’t working for radio widgets — at Version 1

Reported by: Thibaud Colas Owned by: Coen van der Kamp
Component: contrib.admin Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: yes

Description (last modified by Thibaud Colas)

In the Redirects contrib module, when creating a new redirect, the first field is for a Site instance. This is using a radio button (radio_fields ModelAdmin definition: https://github.com/django/django/blob/main/django/contrib/redirects/admin.py#L10). This uses RelatedFieldWidgetWrapper – which doesn’t work for radio widgets. Demo:

https://code.djangoproject.com/raw-attachment/ticket/34624/related-links.gif

If we look at RelatedObjectLookups.js, it seems clear this code was only written to support select widgets.

Tagging this contrib.admin because it seems to affect all usage of RelatedFieldWidgetWrapper – but as far as I can see in Django itself only contrib.redirects uses radio_fields.

---

In this instance I believe a select widget would be a much nicer experience anyway, so not entirely sure whether it makes sense to change the widget to fix this, or update the code to support radio buttons, or do both.

Change History (2)

by Thibaud Colas, 18 months ago

Attachment: related-links.gif added

comment:1 by Thibaud Colas, 18 months ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top