mirror of
https://github.com/django/django.git
synced 2025-07-04 09:49:12 +00:00
[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
This commit is contained in:
parent
402f00a893
commit
a064d0848b
@ -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()
|
||||
|
@ -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():
|
||||
|
Loading…
x
Reference in New Issue
Block a user