File tree 2 files changed +10
-3
lines changed
2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ master (unreleased)
9
9
- Add/Confirm support of Django REST Framework 3.11 (#417).
10
10
- Added a thorough documentation for maintainers
11
11
- Pin psycopg2-binary to 2.8 in testing env to fix CI.
12
+ - Allow to create validations `IS_DATE_IN_THE_FUTURE ` by passing a boolean value instead of a string.
12
13
13
14
Release 7.0.0 (2021-03-11)
14
15
==========================
Original file line number Diff line number Diff line change @@ -128,8 +128,14 @@ class FutureDateSerializer(ValidationSerializer):
128
128
129
129
type_id = 'IS_DATE_IN_THE_FUTURE'
130
130
131
+ def to_internal_value (self , data ):
132
+ if isinstance (data ['value' ], bool ):
133
+ data ['value' ] = str (data ['value' ])
134
+ data = super ().to_internal_value (data )
135
+ return data
136
+
131
137
def validate_value (self , value ):
132
- if value in ['t' , " true" ]:
133
- return " true"
138
+ if value in ['t' , ' true' , 'True' ]:
139
+ return ' true'
134
140
else :
135
- return " false"
141
+ return ' false'
You can’t perform that action at this time.
0 commit comments