class CoreInformation(generics.ListCreateAPIView): queryset = models.CoreInformation.objects.all() serializer_class = CustomCoreInfoSerializer def create(self, request, *args, **kwargs): serializer = self.get_serializer(data=request.data) serializer.is_valid(raise_exception=True) instance = self.perform_create(serializer) serializer = self.get_serializer(instance=instance) return Response(serializer.data, status=status.HTTP_201_CREATED) def perform_create(self, serializer): return serializer.create(validated_data=serializer.validated_data)