mirror of
https://github.com/django/django.git
synced 2025-10-29 16:46:11 +00:00
Fixed #16865 -- Made get_or_create use read database for initial get query.
Thanks Rick van Hattem for the report and trbs for the patch.
This commit is contained in:
@@ -455,9 +455,9 @@ class QuerySet(object):
|
||||
if f.attname in lookup:
|
||||
lookup[f.name] = lookup.pop(f.attname)
|
||||
try:
|
||||
self._for_write = True
|
||||
return self.get(**lookup), False
|
||||
except self.model.DoesNotExist:
|
||||
self._for_write = True
|
||||
try:
|
||||
params = dict([(k, v) for k, v in kwargs.items() if '__' not in k])
|
||||
params.update(defaults)
|
||||
|
||||
Reference in New Issue
Block a user