Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#13069 closed (invalid)

Update on Primary Key performs Insert

Reported by: j.dobos@… Owned by: nobody
Component: Uncategorized Version: 1.1
Severity: Keywords: Primary Key, Update, Insert
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When having a simple table with one column that is set to primary_key=True, changing its value in admin pages executes an insert instead of an update. According to the documentation: http://docs.djangoproject.com/en/dev/ref/models/instances/#how-django-knows-to-update-vs-insert I believe this behaviour is wrong.

Reproduction Steps:
1) Create simple model with one column primary_key=True (tested on charfield)
2) Insert value in the admin page
3) Attempt to change the value

Expected Result:

  • New value replaces the old one

Actual Result:

  • New row is added, the old value stays in the DB too

Change History (2)

comment:1 by Russell Keith-Magee, 14 years ago

Resolution: invalid
Status: newclosed

This is behaving as designed.

in reply to:  1 comment:2 by anonymous, 14 years ago

Replying to russellm:

This is behaving as designed.

If this is the case, I do question such design. Primary Key should be usable as a holder of values, not only as an ID column for row of values (I can sense the same idea being enforced as in auto_id column...).

Note: See TracTickets for help on using tickets.
Back to Top