Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not returning invalid keys in FormSerializer with fail mode #26

Merged
merged 1 commit into from
Feb 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
History
-------

0.3.3 (2019-02-21)
~~~~~~~~~~~~~~~~~~

* Fixing invalid data being copied over in ``FormSerializer`` when fail mode is not ``fail``

0.3.2 (2018-11-21)
~~~~~~~~~~~~~~~~~~

Expand Down
2 changes: 1 addition & 1 deletion drf_braces/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

__author__ = 'Miroslav Shubernetskiy'
__email__ = 'miroslav@miki725.com'
__version__ = '0.3.2'
__version__ = '0.3.3'
2 changes: 1 addition & 1 deletion drf_braces/serializers/form_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def validate(self, data):
raise serializers.ValidationError(form.errors)

else:
cleaned_data = data
cleaned_data = {k: v for k, v in data.items() if k not in form.errors}
# use any cleaned data form might of validated right until
# this moment even if validation failed
cleaned_data.update(_cleaned_data)
Expand Down
1 change: 0 additions & 1 deletion drf_braces/tests/serializers/test_form_serialzier.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,6 @@ def test_validate(self):

self.assertTrue(serializer.is_valid())
self.assertDictEqual(serializer.validated_data, {
'other': 'stuff',
'foo': 'hello',
'bar': 257,
'happy': '',
Expand Down