コード例 #1
0
    def to_native(self, data):
        """
        List of dicts of native values <- List of dicts of primitive datatypes.
        """
        if is_html_input(data):
            data = parse_html_list(data)

        return [self.child.validate(item) for item in data]
コード例 #2
0
ファイル: fields.py プロジェクト: kiennt/core-serializers
 def get_value(self, dictionary):
     if is_html_input(dictionary):
         # HTML forms do not send a `False` value on an empty checkbox,
         # so we override the default empty value to be False.
         return dictionary.get(self.field_name, False)
     return dictionary.get(self.field_name, empty)
コード例 #3
0
 def get_value(self, dictionary):
     # We override the default field access in order to support
     # lists in HTML forms.
     if is_html_input(dictionary):
         return parse_html_list(dictionary, prefix=self.field_name)
     return dictionary.get(self.field_name, empty)