Ticket #16865: patch_16865_get_or_create_move_for_write.diff

File patch_16865_get_or_create_move_for_write.diff, 615 bytes (added by trbs, 3 years ago)
  • django/db/models/query.py

    diff --git a/django/db/models/query.py b/django/db/models/query.py
    index 82378fb..566e910 100644
    a b class QuerySet(object): 
    441441            if f.attname in lookup:
    442442                lookup[f.name] = lookup.pop(f.attname)
    443443        try:
    444             self._for_write = True
    445444            return self.get(**lookup), False
    446445        except self.model.DoesNotExist:
     446            self._for_write = True
    447447            try:
    448448                params = dict([(k, v) for k, v in kwargs.items() if '__' not in k])
    449449                params.update(defaults)
Back to Top