INNER CODE UNIT · Python

Meta

yezyilomo/django-restql · django_restql/fields.py:284

        class Meta(serializer_class.Meta):
            list_serializer_class = BaseNestedFieldListSerializer

        def run_validation(self, data):
            # Run `to_internal_value` only nothing more
            # This is needed only on DRF 3.8.x due to a bug on it
            # This function can be removed on other supported DRF versions
            # i.e v3.7 v3.9 v3.10 etc doesn't need this function
            return self.to_internal_value(data)

        def run_pk_validation(self, pk):
            queryset = self.Meta.model.objects.all()
            validator = PrimaryKeyRelatedField(
                **self.validation_kwargs,
                queryset=queryset,
                many=False
            )
            # If valid return object instead of pk

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…