mirror of
https://github.com/django/django.git
synced 2025-10-29 08:36:09 +00:00
Fixed #26638 -- Allowed callable arguments for QuerySet.get_or_create()/update_or_create() defaults.
This commit is contained in:
@@ -500,6 +500,7 @@ class QuerySet(object):
|
||||
"""
|
||||
try:
|
||||
with transaction.atomic(using=self.db):
|
||||
params = {k: v() if callable(v) else v for k, v in params.items()}
|
||||
obj = self.create(**params)
|
||||
return obj, True
|
||||
except IntegrityError:
|
||||
|
||||
Reference in New Issue
Block a user