Opened 15 years ago

Closed 14 years ago

#11268 closed (invalid)

django.contrib.admin.util.quote does not handle spaces (%20 -> _20)

Reported by: mcsmart Owned by: nobody
Component: contrib.admin Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I have a primary key that allows spaces, e.g., "foo bar", which comes
up in the admin list page properly, but the
URL becomes "http://example.com/admin/myapp/mymodel/foo%20bar/" when I
expect it to become "http://example.com/admin/myapp/mymodel/
foo_20bar/". If you follow the link you'll get a debug page with:

"""
Page not found (404)
Request Method: GET
Request URL: http://example.com/admin/myapp/mymodel/foo%20bar/

mymodel object with primary key u'foo%20bar' does not exist.
"""

It seems that django.contrib.admin.util.quote should convert spaces
along with the other characters it already does.

Attachments (1)

django_contrib_admin_util_quote.diff (948 bytes ) - added by mcsmart 15 years ago.
Patch to trunk/django/contrib/admin/util.py for quote()

Download all attachments as: .zip

Change History (3)

by mcsmart, 15 years ago

Patch to trunk/django/contrib/admin/util.py for quote()

comment:1 by Alex Gaynor, 15 years ago

Needs tests: set

comment:2 by mcsmart, 14 years ago

Resolution: invalid
Status: newclosed

I was unable to reproduce this in a stripped down testcase. We worked around this in our project in another way, but I'm not convinced it's a Django bug. I will reopen if I come up with proof that this is broken in the base system.

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