@anonymous_csrf
def handle403(request):
 no_cookies = False
 referer = request.META.get('HTTP_REFERER')
 if referer:
  no_cookies = (referer.endswith(reverse('users.login')) or referer.endswith(reverse('users.register')))
 return render(request, 'handlers/403.html', {'form': AuthenticationForm(), 'no_cookies': no_cookies}, status=403)

@ anonymous_csrf def handle403 ( request ) : no_cookies = False referer = request . META . get ( 'HTTP_REFERER' ) if referer : no_cookies = ( referer . endswith ( reverse ( 'users.login' ) ) or referer . endswith ( reverse ( 'users.register' ) ) ) return render ( request , 'handlers/403.html' , { 'form' : AuthenticationForm ( ) , 'no_cookies' : no_cookies } , status = 403 )
a 403 message that looks nicer than the normal apache forbidden page .