1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #27975 -- Fixed crash if ModelChoiceField's queryset=None.

Regression in 9153d8fbd6385db9f48793662de789fc3d686841.
This commit is contained in:
James Beith
2017-03-22 16:38:16 +11:00
committed by Tim Graham
parent 325db2a8c3
commit 216bb2e8fb
2 changed files with 13 additions and 1 deletions

View File

@@ -1155,7 +1155,8 @@ class ModelChoiceField(ChoiceField):
def __deepcopy__(self, memo):
result = super(ChoiceField, self).__deepcopy__(memo)
# Need to force a new ModelChoiceIterator to be created, bug #11183
result.queryset = self.queryset.all()
if self.queryset is not None:
result.queryset = self.queryset.all()
return result
def _get_queryset(self):