[Django] #32225: Admin panel: edit popup in model 'change' page results in a not found if the foreign key model contains a space

8 views
Skip to first unread message

Django

unread,
Nov 24, 2020, 12:03:51 PM11/24/20
to django-...@googlegroups.com
#32225: Admin panel: edit popup in model 'change' page results in a not found if
the foreign key model contains a space
-----------------------------------------+-----------------------------
Reporter: Mathis | Owner: nobody
Type: Uncategorized | Status: new
Component: contrib.admin | Version: 3.1
Severity: Normal | Keywords: admin, edit
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+-----------------------------
In the 'change' page of the admin panel, if we try to edit a model linked
by ForeignKey which contains a space in the 'to_field' property, the
result is a 'not found page'.

Example:

{{{
class Media(models.Model):
author = models.ForeignKey('Author', verbose_name="Author",
on_delete=models.SET_NULL, to_field="name", default="Unknown", null=True)
}}}

In this case, if the Author.name contains a space, the generated URL to
edit this author will be:
https://domain.com/admin/web_app/author/Spaced%20Name/change/?_to_field=name&_popup=1

The result is (in french with a translation, sorry):
[[Image(https://i.ibb.co/whYXg2Q/Administration.png)]]

The strange thing is that I can't reproduce this behaviour in my local
version.

--
Ticket URL: <https://code.djangoproject.com/ticket/32225>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Nov 24, 2020, 12:04:46 PM11/24/20
to django-...@googlegroups.com
#32225: Admin panel: edit popup in model 'change' page results in a not found if
the foreign key model contains a space
-------------------------------+--------------------------------------
Reporter: Mathis | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 3.1
Severity: Normal | Resolution:

Keywords: admin, edit | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Mathis):

* type: Uncategorized => Bug


--
Ticket URL: <https://code.djangoproject.com/ticket/32225#comment:1>

Django

unread,
Nov 24, 2020, 1:00:35 PM11/24/20
to django-...@googlegroups.com
#32225: Edit popup in model 'change' page results in a not found if the foreign key
model contains a space
-------------------------------+--------------------------------------
Reporter: Mathis | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 3.1
Severity: Normal | Resolution: duplicate

Keywords: admin, edit | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* resolution: => duplicate


Comment:

I also cannot reproduce this issue with spaces, but it's possible with
other keys, e.g. `_40`. I believe we can close this as a duplicate of
#30386, which is due to the fact that foreign key widgets don't quote
keys.

--
Ticket URL: <https://code.djangoproject.com/ticket/32225#comment:2>

Reply all
Reply to author
Forward
0 new messages