Code

Opened 5 years ago

Closed 4 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: UI/UX:

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 5 years ago.
Patch to trunk/django/contrib/admin/util.py for quote()

Download all attachments as: .zip

Change History (3)

Changed 5 years ago by mcsmart

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

comment:1 Changed 5 years ago by Alex

  • Needs documentation unset
  • Needs tests set
  • Patch needs improvement unset

comment:2 Changed 4 years ago by mcsmart

  • Resolution set to invalid
  • Status changed from new to closed

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.