  
      def create(self, attrs):
          ModelClass = self.Meta.model
  
          # Remove many-to-many relationships from attrs.
          # They are not valid arguments to the default `.create()` method,
          # as they require that the instance has already been saved.
          info = model_meta.get_field_info(ModelClass)
          many_to_many = {}
          for field_name, relation_info in info.relations.items():
 
</s> remove     def create(self, attrs):
 </s> add     def create(self, validated_attrs): </s> remove             if relation_info.to_many and (field_name in attrs):
                many_to_many[field_name] = attrs.pop(field_name)
 </s> add             if relation_info.to_many and (field_name in validated_attrs):
                many_to_many[field_name] = validated_attrs.pop(field_name) </s> remove         instance = ModelClass.objects.create(**attrs)
 </s> add         instance = ModelClass.objects.create(**validated_attrs) </s> remove If you do need custom behavior, you might choose to instead override the `.save()` method on your serializer class. For example:
 </s> add These method should save the object instance by calling `serializer.save()`, adding in any explicit additional arguments as required. They may also perform any custom pre-save or post-save behavior. </s> remove         instance.delete()
 </s> add         self.perform_destroy(instance)
        # Remove many-to-many relationships from validated_attrs.
  
      def create(self, attrs):
          ModelClass = self.Meta.model
  
        # Remove many-to-many relationships from validated_attrs.
          # They are not valid arguments to the default `.create()` method,
          # as they require that the instance has already been saved.
          info = model_meta.get_field_info(ModelClass)
          many_to_many = {}
          for field_name, relation_info in info.relations.items():
keep keep keep keep replace keep keep keep keep keep
 Tweak pre/post save hooks. Return instance in .update(). 
rest_framework/serializers.py