[Answer]-Avoid access to other pages via URL, if not logged on (Django)

1👍

You can use the @login_required decorator above each view that you want to protect:

@login_required
def index(request):
    template = "index.html"
    return render(request,template)

This will ensure that the user has logged in before allowing them access to each view that utilizes this decorator.

See the Documentation for more information.

Leave a comment