Adjust check for FILTERS_NULL_CHOICE_VALUE

This commit is contained in:
Daniel Sheppard 2021-02-11 16:18:48 -06:00 committed by GitHub
parent ff24bb09af
commit 0f964addf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -361,7 +361,7 @@ class DynamicModelChoiceField(DynamicModelChoiceMixin, forms.ModelChoiceField):
When null option is enabled and "None" is sent as part of a form to be submitted, it is sent as the
string 'null'. This will check for that condition and gracefully handle the conversion to a NoneType.
"""
if self.null_option is not None and value == 'null':
if self.null_option is not None and value == settings.FILTERS_NULL_CHOICE_VALUE:
return None
return super().clean(value)