#15779: admin cannot edit records with value 'add' as primary key
-------------------------------------------------+-------------------------
Reporter: Marwan Alsabbagh | Owner: nobody
<marwan.alsabbagh@…> | Status: new
Type: Bug | Component:
Milestone: | contrib.admin
Version: 1.3 | Severity: Normal
Keywords: | Triage Stage:
Has patch: 0 | Unreviewed
-------------------------------------------------+-------------------------
'''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
--
Ticket URL: <http://code.djangoproject.com/ticket/15779>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.