3
0
Fork 0

fix: avoid literal None when rendering form field value

This commit is contained in:
Lance Edgar 2025-01-15 17:01:53 -06:00
parent 9580dde246
commit f0d1f00dd8

View file

@ -1033,12 +1033,13 @@ class Form:
# render static text if field not in deform/schema # render static text if field not in deform/schema
# TODO: need to abstract this somehow # TODO: need to abstract this somehow
if self.model_instance: if self.model_instance:
html = str(self.model_instance[fieldname]) value = self.model_instance[fieldname]
html = str(value) if value is not None else ''
else: else:
html = '' html = ''
# mark all that as safe # mark all that as safe
html = HTML.literal(html) html = HTML.literal(html or ' ')
# render field label # render field label
label = self.get_label(fieldname) label = self.get_label(fieldname)