Created
April 12, 2016 16:33
-
-
Save devStepsize/b973eb82019816172a8d01dc4c85de72 to your computer and use it in GitHub Desktop.
Example authentication template in Django
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib.auth.decorators import login_required | |
from django.shortcuts import render | |
@login_required | |
def my_protected_view(request): | |
"""A view that can only be accessed by logged-in users""" | |
return render(request, 'protected.html', {'current_user': request.user}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment