1
0
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:
Will Koster
2016-05-25 15:33:35 -05:00
committed by Tim Graham
parent 44c7e5d374
commit 9899347641
4 changed files with 46 additions and 8 deletions

View File

@@ -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: