diff options
author | King | 2020-08-27 19:52:45 +0530 |
---|---|---|
committer | GitHub | 2020-08-27 19:52:45 +0530 |
commit | 28ae003e080dcc81f1547cc7bb581293edef9da8 (patch) | |
tree | 913132dbd874c17a8739936383c0ce1202f64d51 /yaksh/views.py | |
parent | f4bf8fd68fa8b9aea29a0a688409f44288494cda (diff) | |
parent | 570b141055f9baa27c539842b14756838949ba60 (diff) | |
download | online_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.py | 4 |
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( |