Commit 192719ee by Petros Moisiadis

Improve coding style

On Tom's suggestion, improve coding style by using a single-line call to getattr() with a default value instead of a multi-line if/else clause.
parent a96ebd74
......@@ -86,11 +86,7 @@ class BasicAuthentication(BaseAuthentication):
"""
Authenticate the userid and password against username and password.
"""
user_model = get_user_model()
if hasattr(user_model, 'USERNAME_FIELD'):
username_field = user_model.USERNAME_FIELD
else:
username_field = 'username'
username_field = getattr(get_user_model(), 'USERNAME_FIELD', 'username')
credentials = {
username_field: userid,
'password': password
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment