#14071: Row duplicated when modifying PK
-------------------------------------------+--------------------------------
Reporter: mnbayazit | Owner: nobody
Status: closed | Milestone:
Component: django.contrib.admin | Version: 1.2
Resolution: wontfix | Keywords:
Stage: Unreviewed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Changes (by SmileyChris):
* status: new => closed
* needs_better_patch: => 0
* resolution: => wontfix
* needs_tests: => 0
* needs_docs: => 0
Comment:
Replying to [ticket:14071 mnbayazit]:
> Create a model and add a field with primary_key=True
> Go into the django admin panel and change this primary key.
> A new entry is added with the new PK, but the old one remains as well.
>
> Sample model:
>
{{{
class FlatPage(Model):
title = CharField(max_length=50)
key = SlugField(max_length=50, primary_key=True, help_text="Do not
change.")
content = TextField()
created = DateTimeField(auto_now_add=True)
updated = DateTimeField(auto_now=True)
def __unicode__(self):
return self.title
class Meta:
app_label = 'app'
}}}
The primary key is exactly how the decision is made as to whether update
or create a new row.
Altering this behavior would be a fundamentally backwards incompatible
change.
--
Ticket URL: <http://code.djangoproject.com/ticket/14071#comment:1>
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.