more reforting

This commit is contained in:
Amir Qayyum Khan
2018-05-25 15:49:29 +05:00
parent 70440672c9
commit 2f7643f7d8
2 changed files with 11 additions and 7 deletions

View File

@@ -2276,7 +2276,7 @@ def get_user_by_username_or_email(username_or_email):
username_or_email = strip_if_string(username_or_email)
# there should be one user with either username or email equal to username_or_email
user = User.objects.get(Q(email=username_or_email) | Q(username=username_or_email))
if user is not None and user.username == username_or_email:
if user.username == username_or_email:
UserRetirementRequest = apps.get_model('user_api', 'UserRetirementRequest')
if UserRetirementRequest.has_user_requested_retirement(user):
raise User.DoesNotExist