File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ master (unreleased)
99- Add/Confirm support of Django REST Framework 3.11 (#417).
1010- Added a thorough documentation for maintainers
1111- 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.
1213
1314Release 7.0.0 (2021-03-11)
1415==========================
Original file line number Diff line number Diff line change @@ -128,8 +128,14 @@ class FutureDateSerializer(ValidationSerializer):
128128
129129 type_id = 'IS_DATE_IN_THE_FUTURE'
130130
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+
131137 def validate_value (self , value ):
132- if value in ['t' , " true" ]:
133- return " true"
138+ if value in ['t' , ' true' , 'True' ]:
139+ return ' true'
134140 else :
135- return " false"
141+ return ' false'
You can’t perform that action at this time.
0 commit comments