summaryrefslogtreecommitdiff
path: root/yaksh/views.py
diff options
context:
space:
mode:
authorprathamesh2020-08-26 18:51:25 +0530
committerprathamesh2020-08-26 19:08:27 +0530
commit570b141055f9baa27c539842b14756838949ba60 (patch)
tree97afa927cf4b1cf807f085bfc578e4e28fca700b /yaksh/views.py
parent3999e744fe1a3a4c4fcb7d2763b36def9d7bb213 (diff)
downloadonline_test-570b141055f9baa27c539842b14756838949ba60.tar.gz
online_test-570b141055f9baa27c539842b14756838949ba60.tar.bz2
online_test-570b141055f9baa27c539842b14756838949ba60.zip
Avoid duplicate user entry with same email address during upload.
Django allows multiple usernames with same email id. Preventing this, as we identify users with their email id or username.
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 3adb536..9f8468d 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -2409,8 +2409,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(