how to get the user id in request user in django code example
Example 1: django request user
def my_view(request):
if not request.user.is_authenticated:
return render(request, 'myapp/login_error.html')
Example 2: how to get user id django
def sample_view(request):
current_user = request.user
print current_user.id