#34242: Behavior of Model.delete() with regards to primary_key fields is not
documented
--------------------------------------+------------------------------------
Reporter: SwampFalc | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Carlton Gibson):
* stage: Unreviewed => Accepted
Comment:
I think something as small as... "the Python instance will still exist and
will still have data in its fields, but the primary key is set to `None`"
in the [https://docs.djangoproject.com/en/4.1/ref/models/instances
/#deleting-objects Deleting objects] docs you point to, would likely be
enough.
> You know, thinking about it some more... What exactly is the reason for
setting the PK to None upon deletion? Is that really necessary?
Standardly, whether the object has a PK is the test whether it's been
saved (i.e. exists in the DB). I doubt that's changeable.
(Others may give a better account.)
--
Ticket URL: <https://code.djangoproject.com/ticket/34242#comment:2>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/010701859a902ce6-e52300ee-a87e-4c8b-a2db-ef8674c9302d-000000%40eu-central-1.amazonses.com.