def update(self, instance, validated_data): errors = Mapping.create_new_version_for( instance, validated_data, self.context.get('request').user) if errors: self._errors.update(errors) return instance
def process(self): if self.version: instance = self.get_queryset().first().clone() errors = Mapping.create_new_version_for(instance, self.data, self.user) return errors or UPDATED instance = Mapping.persist_new(self.data, self.user) if instance.id: return CREATED return instance.errors or FAILED