Skip to content

Commit 26402e4

Browse files
author
Jan Schrewe
committed
One more fix for django 1.4 (untested with django < 1.4)
1 parent ab1c333 commit 26402e4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

mongodbforms/fields.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,16 @@ def clean(self, value):
8989
except (TypeError, InvalidId, self.queryset._document.DoesNotExist):
9090
raise forms.ValidationError(self.error_messages['invalid_choice'] % {'value':value})
9191
return obj
92+
93+
# Fix for Django 1.4
94+
# TODO: Test with older django version
95+
# from django-mongotools by wpjunior
96+
# https://github.com/wpjunior/django-mongotools/
97+
def __deepcopy__(self, memo):
98+
result = super(forms.ChoiceField, self).__deepcopy__(memo)
99+
result.queryset = result.queryset
100+
result.empty_label = result.empty_label
101+
return result
92102

93103
class DocumentMultipleChoiceField(ReferenceField):
94104
"""A MultipleChoiceField whose choices are a model QuerySet."""

0 commit comments

Comments
 (0)