django-lifecycle
django-lifecycle copied to clipboard
id/pk field is None AFTER_DELETE
It's not a big deal to the workflow I am trying to build, but I was surprised to see that a model's id/pk field is set to None by the time the handler for AFTER_DELETE is called. All other fields retain their values. Is this expected behavior?
Yes, this is the expected behaviour. Keep in mind that this gets executed after deletion. If you need the pk
probably you should be using BEFORE_DELETE
.
Similarly, on BEFORE_CREATE
the pk
is not set.