def my_view(request): if not request.user.is_authenticated: return render(request, 'myapp/login_error.html')