diff options
author | adityacp | 2017-05-03 16:10:28 +0530 |
---|---|---|
committer | adityacp | 2017-05-03 16:10:28 +0530 |
commit | a76be3052276945d688ab8746679f25cd40cad3f (patch) | |
tree | 44c4309d1065e953d7f8f13f3b6ed3904d51dc8a /yaksh/views.py | |
parent | 5cebef64ed9f3c164db964828a62c7e0a3bde290 (diff) | |
download | online_test-a76be3052276945d688ab8746679f25cd40cad3f.tar.gz online_test-a76be3052276945d688ab8746679f25cd40cad3f.tar.bz2 online_test-a76be3052276945d688ab8746679f25cd40cad3f.zip |
Change forms.py, views.py and urls.py
- Store activation key expiry time according to timezone for email verification and activation
- Add reverse resolution in urls.py
Diffstat (limited to 'yaksh/views.py')
-rw-r--r-- | yaksh/views.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/yaksh/views.py b/yaksh/views.py index 6a4325e..c7af5cc 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -42,7 +42,7 @@ from yaksh.forms import UserRegisterForm, UserLoginForm, QuizForm,\ from .settings import URL_ROOT from yaksh.models import AssignmentUpload from .file_utils import extract_files -from .email_verification import send_user_mail, generate_activation_key +from .send_emails import send_user_mail, generate_activation_key from .decorators import email_verified @@ -1540,10 +1540,8 @@ def new_activation(request, email=None): if not user.profile.is_email_verified: user.profile.activation_key = generate_activation_key(user.username) - user.profile.key_expiry_time = datetime.strftime( - datetime.now() + \ - timedelta(minutes=20), "%Y-%m-%d %H:%M:%S" - ) + user.profile.key_expiry_time = timezone.now() + \ + timezone.timedelta(minutes=20) user.profile.save() success, msg = send_user_mail(user.email, user.profile.activation_key) if success: @@ -1599,6 +1597,7 @@ def download_assignment_file(request, quiz_id, question_id=None, user_id=None): return response @login_required +@email_verified def duplicate_course(request, course_id): user = request.user course = get_object_or_404(Course, pk=course_id) |