James Crasta committed 4729b5c

Don't add the Required validator on fields which an empty list is a valid option.

  • Participants
  • Parent commits bb103b0

Comments (0)

Files changed (1)


         'RatingProperty':        convert_RatingProperty,
+    # Don't automatically add a required validator for these properties
+    NO_AUTO_REQUIRED = frozenset(['ListProperty', 'StringListProperty'])
     def __init__(self, converters=None):
         Constructs the converter, setting the converter callables.
         :param field_args:
             Optional keyword arguments to construct the field.
+        prop_type_name = type(prop).__name__
         kwargs = {
             'label':'_', ' ').title(),
             'default': prop.default_value(),
         if field_args:
-        if prop.required:
+        if prop.required and prop_type_name not in self.NO_AUTO_REQUIRED:
         if prop.choices:
             kwargs['choices'] = [(v, v) for v in prop.choices]
             return f.SelectField(**kwargs)
-            converter = self.converters.get(type(prop).__name__, None)
+            converter = self.converters.get(prop_type_name, None)
             if converter is not None:
                 return converter(model, prop, kwargs)