[Answered ]-Restrict access per customer in django

1👍

Try:

@login_required(login_url='login') 
def infringement(request, pk):   
      infringement = Infringement.objects.get(id=pk)
      if request.user.customer.id != infringement.customer.id:
          return HttpResponse('Your are not allowed here!!')

Leave a comment