Opened 18 months ago
Last modified 2 months ago
#34624 assigned Bug
RelatedFieldWidgetWrapper links toggling isn’t working for radio widgets
Reported by: | Thibaud Colas | Owned by: | devday |
---|---|---|---|
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 )
Spotted as part of #34622. 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:
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.
Attachments (1)
Change History (13)
by , 18 months ago
Attachment: | related-links.gif added |
---|
comment:1 by , 18 months ago
Description: | modified (diff) |
---|
comment:2 by , 18 months ago
Description: | modified (diff) |
---|
comment:3 by , 18 months ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:4 by , 18 months ago
I'll will first attempt 2.a: "Actually fix the admin's RelatedFieldWidgetWrapper to work with radioselect".
comment:6 by , 16 months ago
Needs tests: | set |
---|---|
Patch needs improvement: | set |
comment:7 by , 8 months ago
Has patch: | unset |
---|---|
Needs tests: | unset |
Owner: | removed |
Patch needs improvement: | unset |
Status: | assigned → new |
Version: | 4.2 → dev |
follow-up: 9 comment:8 by , 8 months ago
Hello! What is the status of this ticket?
I am planning to apply for GSoC, and so I think that trying to solve a ticket would give me a chance to get my hands dirty with the codebase. If this is not assigned to anyone, can I take a look?
comment:9 by , 8 months ago
Replying to Anirudh Prabhakaran:
Hello! What is the status of this ticket?
I am planning to apply for GSoC, and so I think that trying to solve a ticket would give me a chance to get my hands dirty with the codebase. If this is not assigned to anyone, can I take a look?
Hello Anirudh, this ticket is free to be worked on. You can use the existing PR as a starting point. Thanks for wanting to contribute to Django!
follow-up: 11 comment:10 by , 4 months ago
This ticket looks unassigned and it seems no one is currently working on it. I'd like to try to tackle it and put up a PR if there are no objections.
comment:11 by , 2 months ago
Replying to Sasa Cocic-Banjanac:
This ticket looks unassigned and it seems no one is currently working on it. I'd like to try to tackle it and put up a PR if there are no objections.
Are you still working on the issue ?
if not, I'd like to try have a go on it :)
comment:12 by , 2 months ago
Owner: | set to |
---|---|
Status: | new → assigned |
Accepting since I could easily reproduce the issue. In my opinion, we could perhaps do two things:
1- Separately consider whether the
redirects
app should be changed to use a select instead of a radioselect (think of a project with lots of Django Sites, the radio buttons would consume a lot of screen) This would be a separated ticket for theredirects
site.2- Actually fix the admin's RelatedFieldWidgetWrapper to work with radioselect or clealry document that only selects are supported.