Ticket #13251: changes.patch

File changes.patch, 2.6 KB (added by skoom, 15 years ago)
  • django/db/models/base.py

     
    631631        self._collect_sub_objects(seen_objs)
    632632
    633633        # Actually delete the objects.
    634         delete_objects(seen_objs, using)
     634        delete_objects(seen_objs, using, self)
    635635
    636636    delete.alters_data = True
    637637
  • django/db/models/signals.py

     
    88pre_save = Signal(providing_args=["instance", "raw"])
    99post_save = Signal(providing_args=["instance", "raw", "created"])
    1010
    11 pre_delete = Signal(providing_args=["instance"])
    12 post_delete = Signal(providing_args=["instance"])
     11pre_delete = Signal(providing_args=["instance", "origin"])
     12post_delete = Signal(providing_args=["instance", "origin"])
    1313
    1414post_syncdb = Signal(providing_args=["class", "app", "created_models", "verbosity", "interactive"])
    1515
  • django/db/models/query.py

     
    437437
    438438            if not seen_objs:
    439439                break
    440             delete_objects(seen_objs, del_query.db)
     440            delete_objects(seen_objs, del_query.db, self)
    441441
    442442        # Clear the result cache, in case this QuerySet gets reused.
    443443        self._result_cache = None
     
    12661266                                    pass
    12671267    return obj, index_end
    12681268
    1269 def delete_objects(seen_objs, using):
     1269def delete_objects(seen_objs, using, origin):
    12701270    """
    12711271    Iterate through a list of seen classes, and remove any instances that are
    12721272    referred to.
     
    12961296            # Pre-notify all instances to be deleted.
    12971297            for pk_val, instance in items:
    12981298                if not cls._meta.auto_created:
    1299                     signals.pre_delete.send(sender=cls, instance=instance)
     1299                    signals.pre_delete.send(sender=cls, instance=instance, origin=origin)
    13001300
    13011301            pk_list = [pk for pk,instance in items]
    13021302
     
    13281328                        setattr(instance, field.attname, None)
    13291329
    13301330                if not cls._meta.auto_created:
    1331                     signals.post_delete.send(sender=cls, instance=instance)
     1331                    signals.post_delete.send(sender=cls, instance=instance, origin=origin)
    13321332                setattr(instance, cls._meta.pk.attname, None)
    13331333
    13341334        if forced_managed:
Back to Top