Opened 8 years ago

Closed 8 years ago

Last modified 8 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: UI/UX:


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: 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 Changed 8 years ago by Russell Keith-Magee

Resolution: invalid
Status: newclosed

This is behaving as designed.

comment:2 in reply to:  1 Changed 8 years ago by anonymous

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