Hello

With these improvements, your API should now correctly handle booking 
approvals, providing helpful feedback on errors and ensuring that only 
authorized users can approve bookings. If you continue to experience 
issues, please verify the user’s admin status and check your authentication 
setup.

On Friday, August 16, 2024 at 11:33:27 PM UTC+3 siddi...@gmail.com wrote:

> IsAdminUser permission is not allowing staff users to access the endpoint 
>
> @api_view(['POST'])
> @permission_classes([IsAdminUser])
> def approve(request):
>     booking_id = request.data['booking_id']
>     booking_instance = booking.objects.get(id=booking_id)
>     booking_instance.status = 'a'
>     booking_instance.save()
>
>     return Response({'message': 'Booking approved'})
>
> api response for superuser
> {
>   "detail": "You do not have permission to perform this action."
> }
>
> pls help
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-rest-framework+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-rest-framework/5769d7a5-fd68-4317-ae99-c30171a60efbn%40googlegroups.com.

Reply via email to