示例#1
0
 def to_internal_value(self, data):
     """
     List of dicts of native values <- List of dicts of primitive datatypes.
     """
     if html.is_html_input(data):
         data = html.parse_html_list(data)
     if isinstance(data, type('')) or not hasattr(data, '__iter__'):
         self.fail('not_a_list', input_type=type(data).__name__)
     return [self.child.run_validation(item) for item in data]
示例#2
0
 def get_value(self, dictionary):
     # We override the default field access in order to support
     # lists in HTML forms.
     if html.is_html_input(dictionary):
         return html.parse_html_list(dictionary, prefix=self.field_name)
     return dictionary.get(self.field_name, empty)