Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Move logic seperation as its not longer repetitive

  • Loading branch information...
commit abbb88886bb1cd6013432c70586fbc118d378e27 1 parent 6045efa
@dcramer dcramer authored
Showing with 6 additions and 9 deletions.
  1. +6 −9 django/db/models/deletion.py
View
15 django/db/models/deletion.py
@@ -262,14 +262,6 @@ def sort(self):
self.data = SortedDict([(model, self.data[model])
for model in sorted_models])
- def send_post_delete_signals(self, model, instances):
- if model._meta.auto_created:
- return
- for obj in instances:
- signals.post_delete.send(
- sender=model, instance=obj, using=self.using
- )
-
@force_managed
def delete(self):
# sort instance collections
@@ -308,7 +300,12 @@ def delete(self):
query = sql.DeleteQuery(model)
pk_list = [obj.pk for obj in instances]
query.delete_batch(pk_list, self.using)
- self.send_post_delete_signals(model, instances)
+
+ if not model._meta.auto_created:
+ for obj in instances:
+ signals.post_delete.send(
+ sender=model, instance=obj, using=self.using
+ )
# update collected instances
for model, instances_for_fieldvalues in six.iteritems(self.field_updates):

0 comments on commit abbb888

Please sign in to comment.
Something went wrong with that request. Please try again.