summaryrefslogtreecommitdiff
path: root/yaksh/views.py
diff options
context:
space:
mode:
authorKing2020-08-27 19:52:45 +0530
committerGitHub2020-08-27 19:52:45 +0530
commit28ae003e080dcc81f1547cc7bb581293edef9da8 (patch)
tree913132dbd874c17a8739936383c0ce1202f64d51 /yaksh/views.py
parentf4bf8fd68fa8b9aea29a0a688409f44288494cda (diff)
parent570b141055f9baa27c539842b14756838949ba60 (diff)
downloadonline_test-28ae003e080dcc81f1547cc7bb581293edef9da8.tar.gz
online_test-28ae003e080dcc81f1547cc7bb581293edef9da8.tar.bz2
online_test-28ae003e080dcc81f1547cc7bb581293edef9da8.zip
Merge pull request #744 from prathamesh920/fix-upload-users
Avoid duplicate user entry with same email address during upload.
Diffstat (limited to 'yaksh/views.py')
-rw-r--r--yaksh/views.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/yaksh/views.py b/yaksh/views.py
index 15ebd03..c0db7a4 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -2411,8 +2411,10 @@ def _read_user_csv(request, reader, course):
messages.info(request, "{0} -- Missing Values".format(counter))
continue
users = User.objects.filter(username=username)
+ if not users.exists():
+ users = User.objects.filter(email=email)
if users.exists():
- user = users[0]
+ user = users.last()
if remove.strip().lower() == 'true':
_remove_from_course(user, course)
messages.info(request, "{0} -- {1} -- User rejected".format(