Opened 7 years ago

Closed 7 years ago

#16485 closed Bug (worksforme)

Admin URL bug with CharField primary keys

Reported by: Simon Bächler Owned by: nobody
Component: contrib.admin Version: 1.3
Severity: Normal Keywords: admin primary_key
Cc: Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I have the following primary key field:

id = models.CharField(_('id'), max_length=40, primary_key=True)

The value is: 126130274108967_190034094385251 (a Facebook post id)

The admin interface change list correctly shows that id. But the url of the item is
126130274108967_5F190034094385251/ notice the _5F... in the middle.

This causes a 404 every time I create a new entry.


Change History (4)

comment:1 Changed 7 years ago by Bernhard Essl

Triage Stage: UnreviewedDesign decision needed
Version: 1.3SVN

As far as I understand the quote function in do the escaping.
I'm not sure if this is really a bug.

comment:2 Changed 7 years ago by Ramiro Morales

Resolution: worksforme
Status: newclosed

Can't reproduce this with trunk tip nor the 1.3 release, using this model.

from django.db import models

class FacebookPost(models.Model):
    id = models.CharField('id', max_length=40, primary_key=True)

comment:3 Changed 7 years ago by Simon Bächler

Resolution: worksforme
Status: closedreopened
Version: SVN1.3

I just set up a new project from scratch and created just this model. And I still got the error every time. The 404 happens when I click on save and continue editing.

As BernhardEssl mentioned, the primary keys are quoted which probabely makes sense. But then the 'save and continue editing' function should take the quoting into consideration.


comment:4 Changed 7 years ago by Adam Mckerlie

Resolution: worksforme
Status: reopenedclosed

I can verify that the URL is escaped from Trunk (and 1.3, 1.2.6) version but but I can't reproduce the 404 when I click on save and continue editing

Last edited 7 years ago by Adam Mckerlie (previous) (diff)
Note: See TracTickets for help on using tickets.
Back to Top