[Fixed]-How to route API properly?

1👍

Router expects to get viewsets and not api views. Since this is a classical retrieve api i suggest you use the mixin for it. this is how i would rebuild you code.

@permission_classes((permissions.AllowAny,))
class ProductInfo(RetrieveModelMixin, viewsets.GenericViewSet):
    queryset = models.Product.objects.all()
    lookup_field = "slug"
    serializer_class = CitySerializer

Leave a comment