From a064d0848b0467b320bba7d73ecdbf0cb077daf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uro=C5=A1=20Trebec?= Date: Wed, 16 Aug 2006 12:52:35 +0000 Subject: [PATCH] [full-history] * Added a "signal_name" argument to "pre_save" and "pre_delete" signals (I use it so I can use single function to catch both signals and still do different things with them) git-svn-id: http://code.djangoproject.com/svn/django/branches/full-history@3595 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/models/base.py | 2 +- django/db/models/query.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/django/db/models/base.py b/django/db/models/base.py index bdae7eccc2..f348f8d280 100644 --- a/django/db/models/base.py +++ b/django/db/models/base.py @@ -160,7 +160,7 @@ class Model(object): _prepare = classmethod(_prepare) def save(self): - dispatcher.send(signal=signals.pre_save, sender=self.__class__, instance=self) + dispatcher.send(signal=signals.pre_save, sender=self.__class__, instance=self, signal_name='pre_save') non_pks = [f for f in self._meta.fields if not f.primary_key] cursor = connection.cursor() diff --git a/django/db/models/query.py b/django/db/models/query.py index 0b85c3f515..883f013d7a 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -921,7 +921,7 @@ def delete_objects(seen_objs): # Pre notify all instances to be deleted for pk_val, instance in seen_objs[cls]: - dispatcher.send(signal=signals.pre_delete, sender=cls, instance=instance) + dispatcher.send(signal=signals.pre_delete, sender=cls, instance=instance, signal_name='pre_delete') pk_list = [pk for pk,instance in seen_objs[cls]] for related in cls._meta.get_all_related_many_to_many_objects():