﻿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
24041	Document effects of saving a model after changing its primary key	Vedant Lath	Helen Sherwood-Taylor	"When the value of a primary key field in a record is changed in the admin interface, a new record gets created and the previous record is untouched. This means that the primary key field of a model is effectively read-only and its values cannot be changed.

Steps to reproduce:
1. Define a model M as:
{{{
class M(models.Model):
    name = models.CharField(max_length=200, primary_key=True)
}}}

2. Create a record in M with name as 'ABC' and save it.
3. Change the name in the above record to 'XYZ' and save it.

Expected result:
the record 'ABC' is changed to 'XYZ' with an SQL UPDATE command.

Actual result:
a new record 'XYZ' is created and the previous record 'ABC' also exists. No warning or any other message is shown.

If this is intended behaviour, it should be documented appropriately in the primary_key parameter and maybe other places."	Cleanup/optimization	closed	Documentation	1.7	Normal	fixed			Accepted	0	0	0	0	0	0
