Ticket #5559: post_delete_pk.diff
File post_delete_pk.diff, 1.3 KB (added by , 17 years ago) |
---|
-
django/db/models/query.py
1180 1180 if field.rel and field.null and field.rel.to in seen_objs: 1181 1181 setattr(instance, field.attname, None) 1182 1182 1183 dispatcher.send(signal=signals.post_delete, sender=cls, instance=instance) 1183 1184 setattr(instance, cls._meta.pk.attname, None) 1184 dispatcher.send(signal=signals.post_delete, sender=cls, instance=instance)1185 1185 1186 1186 transaction.commit_unless_managed() -
tests/modeltests/signals/models.py
54 54 pre_delete signal, Tom Smith 55 55 instance.id is not None: True 56 56 post_delete signal, Tom Smith 57 instance.id is None: True57 instance.id is None: False 58 58 59 59 >>> p2 = Person(first_name='James', last_name='Jones') 60 60 >>> p2.id = 99999 … … 73 73 pre_delete signal, James Jones 74 74 instance.id is not None: True 75 75 post_delete signal, James Jones 76 instance.id is None: True76 instance.id is None: False 77 77 78 78 >>> Person.objects.all() 79 79 [<Person: James Jones>]