  
          # Set the serializer object if it exists
          obj = getattr(self.parent.object, field_name) if self.parent.object else None
  
          if value in (None, ''):
              into[(self.source or field_name)] = None
          else:
              kwargs = {
 
</s> remove                 'many': self.many
 </s> add                 'many': self.many,
                'allow_add_remove': self.allow_add_remove </s> remove         self.allow_delete = allow_delete
 </s> add         self.allow_add_remove = allow_add_remove </s> remove                     # TODO: Following will be needed for reverse FK
                    # if field.many:
                    #     # Nested reverse fk relationship
                    #     for related_item in related:
                    #         fk_field = obj._meta.get_field_by_name(accessor_name)[0].field.name
                    #         setattr(related_item, fk_field, obj)
                    #         self.save_object(related_item)
                    # else:
                    # Nested reverse one-one relationship
                    fk_field = obj._meta.get_field_by_name(accessor_name)[0].field.name
                    setattr(related, fk_field, obj)
                    self.save_object(related)
 </s> add                     if field.many:
                        # Nested reverse fk relationship
                        for related_item in related:
                            fk_field = obj._meta.get_field_by_name(accessor_name)[0].field.name
                            setattr(related_item, fk_field, obj)
                            self.save_object(related_item)
                    else:
                        # Nested reverse one-one relationship
                        fk_field = obj._meta.get_field_by_name(accessor_name)[0].field.name
                        setattr(related, fk_field, obj)
                        self.save_object(related) </s> remove                  allow_delete=False, **kwargs):
 </s> add                  allow_add_remove=False, **kwargs):
        obj = obj.all() if is_simple_callable(getattr(obj, 'all', None)) else obj
  
          # Set the serializer object if it exists
          obj = getattr(self.parent.object, field_name) if self.parent.object else None
        obj = obj.all() if is_simple_callable(getattr(obj, 'all', None)) else obj
  
          if value in (None, ''):
              into[(self.source or field_name)] = None
          else:
              kwargs = {
keep keep add keep keep keep keep keep
 one-many writable nested modelserializer support 
rest_framework/serializers.py