def decorator(func):
@wraps(func)
def inner(request, *args, **kwargs):
pdb.set_trace()
a1 = args
user = a1[1]._request.user
permission = Permission.objects.get(user=user)
# < Permission: bookings | Booking | Can view Booking >
return func(*args, **kwargs)
return inner
class OfferListAPIView(generics.ListCreateAPIView):
queryset = Offers.objects.all().order_by('-id')
serializer = OfferListSerializer
def list(self, request):
queryset = self.get_queryset()
serializer = OfferListSerializer(queryset, many=True)
return response_handler(data=serializer.data, message="All offer list fetched.")The requested user have a permissions to view only booking , and the class is mainly for Offer List API , how can I map this and displayan error you dont have permission to access this. , I am working with Angular and Django . please help me
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5714f9b2-2402-4c33-8e1f-e6dc605fcb7co%40googlegroups.com.
No comments:
Post a Comment