Hi,
I’m currently working on Full Stack app with React app as Frontend and Django app as backend. I configured everything as is described in this document (Auth0 Django API SDK Quickstarts: Add Authorization to a Django API Application). Everything works good if as view I use example form tutorial:
@require_auth(None)
def private(request):
response = "Hello from a private endpoint! You need to be authenticated to see this."
return JsonResponse(dict(message=response))
But if I try instead that get the serialized data (code below) from DB i always get error:
class ProductList(APIView):
@require_auth(None)
def get(self, request):
products = Product.objects.all()
serializer = ProductSerializer(products, many=True)
return Response(serializer.data)
Error message:
AttributeError: ‘ProductList’ object has no attribute ‘build_absolute_uri’
Do you have any ideas how can I solve this problem ? Thank you