﻿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
34242	Behavior of Model.delete() with regards to primary_key fields is not documented	SwampFalc	noFFENSE	"When .delete() is called on a model instance, the primary_key field of that instance is set to None (https://github.com/django/django/blob/main/django/db/models/deletion.py#L456).

For a ""standard"" autoincrement PK, this is fine. However, if you have defined an actual data field as primary_key on the model, this data is lost in the instance.

This is counter to what is stated in the basic documentation about ""Deleting objects"" (https://docs.djangoproject.com/en/4.1/ref/models/instances/#deleting-objects): ""This only deletes the object in the database; the Python instance will still exist and will still have data in its fields.""

There is also no mention of this in the documentation of ""primary_key"" (https://docs.djangoproject.com/en/4.1/ref/models/fields/#primary-key) or the more in-depth documentation about ""Deleting objects"" (https://docs.djangoproject.com/en/4.1/topics/db/queries/#deleting-objects).

I feel that this should at the very least be mentioned in the ""primary_key"" documentation, perhaps in some of the other locations too.

If an agreement can be reached about where it should be mentioned and where not, I am willing to create a pull request."	Cleanup/optimization	closed	Documentation	dev	Normal	fixed			Ready for checkin	1	0	0	0	1	0
