summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Kaplan-Moss <jacob@jacobian.org>2007-09-24 18:27:42 +0000
committerJacob Kaplan-Moss <jacob@jacobian.org>2007-09-24 18:27:42 +0000
commit960c1263b60b4341a1a0ddf192ab1102a94d20af (patch)
tree215e30c42458f99c2b57a5808b11120adb912330
parent4edecaeae95ac02339f51d84dbe0dd414c7c3d61 (diff)
Fixed #5559: instances sent via post-save signals no longer have pks of None. Thanks, Joseph Kocherhans.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6411 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/db/models/query.py2
-rw-r--r--tests/modeltests/signals/models.py4
2 files changed, 3 insertions, 3 deletions
diff --git a/django/db/models/query.py b/django/db/models/query.py
index 23d0bac6c8..4d0d295e97 100644
--- a/django/db/models/query.py
+++ b/django/db/models/query.py
@@ -1180,7 +1180,7 @@ def delete_objects(seen_objs):
if field.rel and field.null and field.rel.to in seen_objs:
setattr(instance, field.attname, None)
- setattr(instance, cls._meta.pk.attname, None)
dispatcher.send(signal=signals.post_delete, sender=cls, instance=instance)
+ setattr(instance, cls._meta.pk.attname, None)
transaction.commit_unless_managed()
diff --git a/tests/modeltests/signals/models.py b/tests/modeltests/signals/models.py
index d41142135e..1fb73828bb 100644
--- a/tests/modeltests/signals/models.py
+++ b/tests/modeltests/signals/models.py
@@ -54,7 +54,7 @@ Is updated
pre_delete signal, Tom Smith
instance.id is not None: True
post_delete signal, Tom Smith
-instance.id is None: True
+instance.id is None: False
>>> p2 = Person(first_name='James', last_name='Jones')
>>> p2.id = 99999
@@ -73,7 +73,7 @@ Is created
pre_delete signal, James Jones
instance.id is not None: True
post_delete signal, James Jones
-instance.id is None: True
+instance.id is None: False
>>> Person.objects.all()
[<Person: James Jones>]