diff --git a/arches_lingo/views/api/pythonic_models.py b/arches_lingo/views/api/pythonic_models.py index b69204f3..9fd70c9c 100644 --- a/arches_lingo/views/api/pythonic_models.py +++ b/arches_lingo/views/api/pythonic_models.py @@ -55,7 +55,7 @@ def destroy(self, request, *args, **kwargs): ) return super().destroy(request, *args, **kwargs) - def perform_update(self, serializer): + def validate_tile_data_and_save_resource(self, serializer): """Re-raise ValidationError as DRF ValidationError. In 3.0 (2014), DRF decided to stop full_clean()'ing before save(), @@ -76,6 +76,12 @@ def perform_update(self, serializer): except DjangoValidationError as django_error: raise ValidationError(detail=django_error) from django_error + def perform_create(self, serializer): + self.validate_tile_data_and_save_resource(serializer) + + def perform_update(self, serializer): + self.validate_tile_data_and_save_resource(serializer) + class SchemeDetailView(PythonicModelAPIMixin, RetrieveUpdateDestroyAPIView): permission_classes = [IsAuthenticated]