Compare commits

...

1 Commits

Author SHA1 Message Date
Daniil Fajnberg 6b241feda5 form field `clean` now force-stringifies value 2022-04-26 21:55:56 +02:00
1 changed files with 2 additions and 1 deletions

View File

@ -61,7 +61,8 @@ class FormField:
def valid_option(self, option: str) -> bool:
return self.options is None or option in self.options.keys() or option in self.options.values()
def clean(self, value: str) -> str:
def clean(self, value: Any) -> str:
value = str(value)
if self.options is None or value in self.options.keys():
return value
# Try to find an unambiguous match in the visible option texts: