Opened 13 years ago
Closed 13 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 |
Description
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.
Regards
Simon
Change History (4)
comment:1 by , 13 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|---|
Version: | 1.3 → SVN |
comment:2 by , 13 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
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 by , 13 years ago
Resolution: | worksforme |
---|---|
Status: | closed → reopened |
Version: | SVN → 1.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.
Regards
Simon
comment:4 by , 13 years ago
Resolution: | → worksforme |
---|---|
Status: | reopened → closed |
I can verify that the URL is escaped from SVN version but but I can't reproduce the 404 when I click on save and continue editing
As far as I understand the quote function in util.py https://code.djangoproject.com/browser/django/trunk/django/contrib/admin/util.py#L15 do the escaping.
I'm not sure if this is really a bug.