parameters: (self, data)
return_statement: return ret
docstring: List of dicts of native values <- List of dicts of primitive datatypes.
docstring_summary: List of dicts of native values <- List of dicts of primitive datatypes.
docstring_tokens: List of dicts of native values < - List of dicts of primitive datatypes .
function: def to_internal_value(self, data):
          """
          List of dicts of native values <- List of dicts of primitive datatypes.
          """
          if self.instance is None:
              return super().to_internal_value(data)
  
          if html.is_html_input(data):
              data = html.parse_html_list(data)
  
          if not isinstance(data, list):
              message = self.error_messages['not_a_list'].format(
                  input_type=type(data).__name__
              )
              raise ValidationError({
                  api_settings.NON_FIELD_ERRORS_KEY: [message]
              }, code='not_a_list')
  
          if not self.allow_empty and len(data) == 0:
              if self.parent and self.partial:
                  raise SkipField()
  
              message = self.error_messages['empty']
              raise ValidationError({
                  api_settings.NON_FIELD_ERRORS_KEY: [message]
              }, code='empty')
  
          ret = []
          errors = []
  
          for item in data:
              try:
                  # prepare child serializer to only handle one instance
                  if 'id' in item:
                      pk = item["id"]
                  elif 'pk' in item:
                      pk = item["pk"]
                  else:
                      raise ValidationError("id or pk not in data")
                  child = self.instance.get(id=pk)
                  self.child.instance = child
                  self.child.initial_data = item
                  # raw
                  validated = self.child.run_validation(item)
              except ValidationError as exc:
                  errors.append(exc.detail)
              except ObjectDoesNotExist as e:
                  errors.append(e)
              else:
                  ret.append(validated)
                  errors.append({})
  
          if any(errors):
              raise ValidationError(errors)
  
          return ret
function_tokens: def to_internal_value ( self , data ) : if self . instance is None : return super ( ) . to_internal_value ( data ) if html . is_html_input ( data ) : data = html . parse_html_list ( data ) if not isinstance ( data , list ) : message = self . error_messages [ 'not_a_list' ] . format ( input_type = type ( data ) . __name__ ) raise ValidationError ( { api_settings . NON_FIELD_ERRORS_KEY : [ message ] } , code = 'not_a_list' ) if not self . allow_empty and len ( data ) == 0 : if self . parent and self . partial : raise SkipField ( ) message = self . error_messages [ 'empty' ] raise ValidationError ( { api_settings . NON_FIELD_ERRORS_KEY : [ message ] } , code = 'empty' ) ret = [ ] errors = [ ] for item in data : try : # prepare child serializer to only handle one instance if 'id' in item : pk = item [ "id" ] elif 'pk' in item : pk = item [ "pk" ] else : raise ValidationError ( "id or pk not in data" ) child = self . instance . get ( id = pk ) self . child . instance = child self . child . initial_data = item # raw validated = self . child . run_validation ( item ) except ValidationError as exc : errors . append ( exc . detail ) except ObjectDoesNotExist as e : errors . append ( e ) else : ret . append ( validated ) errors . append ( { } ) if any ( errors ) : raise ValidationError ( errors ) return ret