Ticket #29016: fix_delete_on_update.patch

File fix_delete_on_update.patch, 997 bytes (added by Étienne Loks, 3 years ago)

Simple patch version (no regression test yet)

  • django/db/models/deletion.py

    From 8e453ad2213a2e54caa4cd87d3d6f31558ac8a4f Mon Sep 17 00:00:00 2001
    From: =?UTF-8?q?=C3=89tienne=20Loks?= <etienne.loks@iggdrasil.net>
    Date: Fri, 12 Jan 2018 17:08:00 +0100
    Subject: [PATCH] Fix delete on update
    
    ---
     django/db/models/deletion.py | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/django/db/models/deletion.py b/django/db/models/deletion.py
    index 26073be3ba..590d5a2298 100644
    a b class Collector(object): 
    286286
    287287            # update fields
    288288            for model, instances_for_fieldvalues in six.iteritems(self.field_updates):
    289                 query = sql.UpdateQuery(model)
    290289                for (field, value), instances in six.iteritems(instances_for_fieldvalues):
     290                    query = sql.UpdateQuery(model)
    291291                    query.update_batch([obj.pk for obj in instances],
    292292                                       {field.name: value}, self.using)
    293293
Back to Top