Opened 8 years ago

Closed 8 years ago

#5045 closed (duplicate)

Primary keys containing URL characters breaks admin links

Reported by: robbie@… Owned by: adrian
Component: contrib.admin Version: master
Severity: Keywords: unicode
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


The quote function, used by the admin application to escape url characters, incorrectly checks for strings:

    if type(s) != type(''):
        return s

This obviously fails now that Django can return a unicode string for field values, resulting in broken links for objects with url characters in their primary key.

Checking against basestring would seem to be one way to go:

    if not isinstance(s, basestring):
        return s

...but perhaps the admin application should be changed to use django.utils.http.urlquote since this performs a similar function?

Attachments (1)

admin-quote_unicode.patch (506 bytes) - added by robbie@… 8 years ago.
Simple patch to correctly catch strings & unicode strings

Download all attachments as: .zip

Change History (3)

Changed 8 years ago by robbie@…

Simple patch to correctly catch strings & unicode strings

comment:1 Changed 8 years ago by jdetaeye@…

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

Ticket #5041 also touches on this problem.

comment:2 Changed 8 years ago by SmileyChris

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

Closing as a duplicate of #5041, since that incorporates this change and has been accepted.

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