diff sat/tools/xml_tools.py @ 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 0fac164ff2d8
children 4cb38c8312a1
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({