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

Refs #27563 -- Fixed ModelChoiceField.__deepcopy__() so forms don't share a queryset cache.

Thanks Luke Benstead for the report Simon Charettes for the fix.
This commit is contained in:
Tim Graham
2017-03-15 12:54:26 -04:00
committed by GitHub
parent 0d83052e52
commit 44f9241c48
2 changed files with 10 additions and 1 deletions

View File

@@ -1155,7 +1155,7 @@ 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 = result.queryset
result.queryset = self.queryset.all()
return result
def _get_queryset(self):