#30386: Admin foreign key widgets don't quote keys
-----------------------------------------+------------------------
Reporter: jclgoodwin | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 2.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
In django.contrib.admin.ModelAdmin, _changeform_view, _delete_view and
history_view and do unquote(object_id):
https://github.com/django/django/blob/917fd9d03fdd21538864af4b412ac30b36d99268/django/contrib/admin/options.py#L1537
However, ForeignKeyRawIdWidget and RelatedFieldWidgetWrapper create links
to this view without calling quote():
https://github.com/django/django/blob/89a2216486fa8a0513cbb1d49d2d587d4116c60b/django/contrib/admin/widgets.py#L191
Steps to reproduce:
1. Create two models: Topping with a CharField primary key, and Pizza with
a ForeignKey to Topping. Register both models with the admin site.
2. Create a Topping with the primary key '_40', and a Pizza with that
topping
3. In the admin site, go the the /change/ page for the Pizza, and click on
the 'change' icon for the Topping foreign key, or (if using
ForeignKeyRawIdWidget) the link to the Topping '_40'.
4. See message 'Topping with ID "@" doesn't exist. Perhaps it was
deleted?'.
--
Ticket URL: <https://code.djangoproject.com/ticket/30386>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/053.f3f2b530761bb45e50a3562f816e4e54%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.