Skip to content

Commit

Permalink
Merge pull request #26 from dealertrack/invalid
Browse files Browse the repository at this point in the history
not returning invalid keys in FormSerializer with fail mode
  • Loading branch information
miki725 committed Feb 22, 2019
2 parents b7ed129 + 415dae4 commit 9ddc13f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions HISTORY.rst
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
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
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
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

0 comments on commit 9ddc13f

Please sign in to comment.