Opened 5 years ago

Closed 5 years ago

#16485 closed Bug (worksforme)

Admin URL bug with CharField primary keys

Reported by: sbaechler 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 5 years ago by BernhardEssl

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Design decision needed
  • Version changed from 1.3 to SVN

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 5 years ago by ramiro

  • Resolution set to worksforme
  • Status changed from new to 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 Changed 5 years ago by sbaechler

  • Resolution worksforme deleted
  • Status changed from closed to reopened
  • Version changed from SVN to 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.


comment:4 Changed 5 years ago by silent1mezzo

  • Resolution set to worksforme
  • Status changed from reopened to 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

Version 0, edited 5 years ago by silent1mezzo (next)
Note: See TracTickets for help on using tickets.
Back to Top