mirror of
				https://github.com/django/django.git
				synced 2025-10-31 01:25:32 +00:00 
			
		
		
		
	Move logic seperation as its not longer repetitive
This commit is contained in:
		| @@ -262,14 +262,6 @@ class Collector(object): | |||||||
|         self.data = SortedDict([(model, self.data[model]) |         self.data = SortedDict([(model, self.data[model]) | ||||||
|                                 for model in sorted_models]) |                                 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 |     @force_managed | ||||||
|     def delete(self): |     def delete(self): | ||||||
|         # sort instance collections |         # sort instance collections | ||||||
| @@ -308,7 +300,12 @@ class Collector(object): | |||||||
|             query = sql.DeleteQuery(model) |             query = sql.DeleteQuery(model) | ||||||
|             pk_list = [obj.pk for obj in instances] |             pk_list = [obj.pk for obj in instances] | ||||||
|             query.delete_batch(pk_list, self.using) |             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 |         # update collected instances | ||||||
|         for model, instances_for_fieldvalues in six.iteritems(self.field_updates): |         for model, instances_for_fieldvalues in six.iteritems(self.field_updates): | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user