changeset 3903:384b7e6c2dbf

tools (xml_tools): handle `required` field in `dataDict2dataForm`: rel 372
author Goffi <goffi@goffi.org>
date Wed, 21 Sep 2022 22:43:55 +0200
parents 32b38dd3ac18
children 0aa7023dcd08
files sat/tools/xml_tools.py
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/sat/tools/xml_tools.py	Wed Sep 21 22:41:49 2022 +0200
+++ b/sat/tools/xml_tools.py	Wed Sep 21 22:43:55 2022 +0200
@@ -259,6 +259,7 @@
             - "xhtml" is used for "xml" fields with child in the C.NS_XHTML namespace
             - "options" are list of dict with optional "label" and mandatory "value"
               following suitable attributes from data_form.Option
+            - "required" is the same as data_form.Field.required
     """
     # TODO: describe format
     fields = []
@@ -269,6 +270,7 @@
             "var": field_data["name"],
             "label": field_data.get('label'),
             "value": field_data.get("value"),
+            "required": field_data.get("required")
         }
         if field_type == "xhtml":
             kwargs.update({