Ticket #6915: 6915.naive-patch.diff

File 6915.naive-patch.diff, 755 bytes (added by emulbreh, 7 years ago)
  • django/db/models/query.py

     
    270270        del_query.query.select_related = False
    271271        del_query.query.clear_ordering()
    272272
     273        # Delete objects individually if self.model has a custom delete()
     274        # method. See ticket #6915.
     275        from django.db.models.base import Model
     276        if self.model is not None and self.model.delete != Model.delete:
     277            for obj in self:
     278                obj.delete()
     279            return
     280
    273281        # Delete objects in chunks to prevent the list of related objects from
    274282        # becoming too long.
    275283        while 1:
Back to Top