﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
15779	admin cannot edit records with value 'add' as primary key	Marwan Alsabbagh <marwan.alsabbagh@…>	Claude Paroz	"'''Problem'''
 If you have a model with a primary key field that has the value 'add' you won't be able to edit it in the admin screens. the admin will take you to the add page instead of the change page for that record. this is a problem with the design of the urls in the admin module. Example code follows:


'''admin.py'''



{{{
from polls.models import poll
from django.contrib import admin

admin.site.register(poll)
}}}


'''model.py'''


{{{
from django.db import models

class poll(models.Model):
   id = models.CharField(max_length=200, primary_key=True)
   question = models.CharField(max_length=200)

}}}


'''Reproducing'''


 1. Create project and app, enable admin, add the above files and syncdb.
 2. Go to the admin interface and select Add poll
 3. specify 'add' as the id and 'test' as question
 4. Save
 5. Go back to the list
 6. Open the same object
 7. you will be taken to the add poll screen instead of the change poll screen for the selected object"	Bug	closed	contrib.admin	dev	Release blocker	fixed		Simon Charette	Ready for checkin	1	0	0	0	0	0
