get user model django code example
Example 1: django import user
from django.contrib.auth.models import User
Example 2: django user fields
username
first_name
last_name
email
password
groups
user_permissions
is_staff
is_active
is_superuser
last_login
date_joined
Example 3: how to get user id django
def sample_view(request):
current_user = request.user
print current_user.id
Example 4: import abstractuser
from django.contrib.auth.models import AbstractUser
Example 5: how to get user id django
if request.user.is_authenticated:
else:
Example 6: how to get the user argent in django
request.META['HTTP_USER_AGENT']