Ticket #5559: post_delete_pk.diff

File post_delete_pk.diff, 1.3 KB (added by jkocherhans, 17 years ago)
  • django/db/models/query.py

     
    11801180                if field.rel and field.null and field.rel.to in seen_objs:
    11811181                    setattr(instance, field.attname, None)
    11821182
     1183            dispatcher.send(signal=signals.post_delete, sender=cls, instance=instance)
    11831184            setattr(instance, cls._meta.pk.attname, None)
    1184             dispatcher.send(signal=signals.post_delete, sender=cls, instance=instance)
    11851185
    11861186    transaction.commit_unless_managed()
  • tests/modeltests/signals/models.py

     
    5454pre_delete signal, Tom Smith
    5555instance.id is not None: True
    5656post_delete signal, Tom Smith
    57 instance.id is None: True
     57instance.id is None: False
    5858
    5959>>> p2 = Person(first_name='James', last_name='Jones')
    6060>>> p2.id = 99999
     
    7373pre_delete signal, James Jones
    7474instance.id is not None: True
    7575post_delete signal, James Jones
    76 instance.id is None: True
     76instance.id is None: False
    7777
    7878>>> Person.objects.all()
    7979[<Person: James Jones>]
Back to Top