Skip to content

Commit fcbee11

Browse files
committed
Skip processing of the FormField if value is not required and empty 🌧
1 parent a02e869 commit fcbee11

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.5.2 : 19.12.2019
2+
3+
- **Fix**: Skip processing of the `FormField` if value is not required and empty
4+
15
## 0.5.1 : 19.12.2019
26

37
- **Fix**: Process `EnumField` even if it's not marked as required
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.5.1'
1+
__version__ = '0.5.2'

django_request_formatter/fields.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ def __init__(self, form: typing.Type, **kwargs):
5757
def form(self):
5858
return self._form
5959

60-
def to_python(self, value) -> dict:
60+
def to_python(self, value) -> typing.Union[typing.Dict, None]:
61+
if not value:
62+
return None
63+
6164
form = self._form(value)
6265
if form.is_valid():
6366
return form.cleaned_data

0 commit comments

Comments
 (0)