You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

10 lines
298 B

try:
from django.contrib.auth import get_user_model
except ImportError:
from django.contrib.auth.models import User
get_user_model = lambda: User # noqa
def get_username(user):
username_field = getattr(user, 'USERNAME_FIELD', 'username')
return getattr(user, username_field)