From 7394f857c41865ae32b50c18609362ac5397ec4c Mon Sep 17 00:00:00 2001 From: maheshgudi Date: Thu, 7 Jul 2016 15:42:38 +0530 Subject: minor timezone related changes in models and test cases --- yaksh/models.py | 8 ++++++-- yaksh/tests.py | 5 +++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/yaksh/models.py b/yaksh/models.py index c48eef1..ddfd5db 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -163,7 +163,9 @@ class Profile(models.Model): department = models.CharField(max_length=64) position = models.CharField(max_length=64) timezone = models.CharField(max_length=64, - choices=[(tz, tz) for tz in pytz.common_timezones]) + default=pytz.utc.zone, + choices=[(tz, tz) for tz in pytz.common_timezones] + ) ############################################################################### @@ -340,7 +342,9 @@ class QuizManager(models.Manager): trial_quiz.duration = 1000 trial_quiz.active = True trial_quiz.start_date_time = timezone.now() - trial_quiz.end_date_time = datetime(2199, 1, 1, 0, 0, 0, 0) + trial_quiz.end_date_time = datetime(2199, 1, 1, 0, 0, 0, 0, + tzinfo=pytz.utc + ) trial_quiz.save() return trial_quiz diff --git a/yaksh/tests.py b/yaksh/tests.py index e65e699..9b5971c 100644 --- a/yaksh/tests.py +++ b/yaksh/tests.py @@ -230,8 +230,9 @@ class QuizTestCases(unittest.TestCase): self.assertEqual(trial_quiz.duration, 1000) self.assertTrue(trial_quiz.active) self.assertEqual(trial_quiz.end_date_time, - datetime(2199, 1, 1, 0, 0, 0, 0) - ) + datetime(2199, 1, 1, 0, 0, 0, 0, + tzinfo=pytz.utc.zone) + ) self.assertEqual(trial_quiz.time_between_attempts, 0) def test_create_trial_from_quiz_usermode(self): -- cgit From f1fd7ece4fed04c333df436e39fd89f37133070e Mon Sep 17 00:00:00 2001 From: maheshgudi Date: Thu, 7 Jul 2016 15:47:13 +0530 Subject: corrected minor change --- yaksh/tests.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/yaksh/tests.py b/yaksh/tests.py index 9b5971c..8bd2dda 100644 --- a/yaksh/tests.py +++ b/yaksh/tests.py @@ -230,9 +230,8 @@ class QuizTestCases(unittest.TestCase): self.assertEqual(trial_quiz.duration, 1000) self.assertTrue(trial_quiz.active) self.assertEqual(trial_quiz.end_date_time, - datetime(2199, 1, 1, 0, 0, 0, 0, - tzinfo=pytz.utc.zone) - ) + datetime(2199, 1, 1, 0, 0, 0, 0, tzinfo=pytz.utc) + ) self.assertEqual(trial_quiz.time_between_attempts, 0) def test_create_trial_from_quiz_usermode(self): -- cgit From 87f3f30b4288bcc867fd0f18f7d845484aaf910c Mon Sep 17 00:00:00 2001 From: maheshgudi Date: Fri, 8 Jul 2016 10:58:28 +0530 Subject: made minor changes in creating test quiz --- yaksh/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/yaksh/models.py b/yaksh/models.py index ddfd5db..4ee6141 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -336,10 +336,11 @@ class QuizManager(models.Manager): trial_quiz.pk = None trial_quiz.description = trial_quiz_name trial_quiz.is_trial = True - trial_quiz.time_between_attempts = 0 trial_quiz.prerequisite = None if godmode: + trial_quiz.time_between_attempts = 0 trial_quiz.duration = 1000 + trial_quiz.attempts_allowed = -1 trial_quiz.active = True trial_quiz.start_date_time = timezone.now() trial_quiz.end_date_time = datetime(2199, 1, 1, 0, 0, 0, 0, -- cgit From 2725f202757694d966d00c413b327bb163fba67f Mon Sep 17 00:00:00 2001 From: maheshgudi Date: Mon, 11 Jul 2016 16:07:04 +0530 Subject: changed templates for forgot password and change password --- yaksh/templates/register/password_change_done.html | 16 ++++++++++++++++ yaksh/templates/register/password_change_form.html | 18 ++++++++++++++++++ yaksh/templates/register/password_reset_complete.html | 7 +++++++ yaksh/templates/register/password_reset_confirm.html | 17 +++++++++++++++++ yaksh/templates/register/password_reset_done.html | 4 ++++ yaksh/templates/register/password_reset_form.html | 12 ++++++++++++ yaksh/templates/registration/password_change_done.html | 16 ---------------- yaksh/templates/registration/password_change_form.html | 18 ------------------ .../registration/password_reset_complete.html | 7 ------- .../templates/registration/password_reset_confirm.html | 17 ----------------- yaksh/templates/registration/password_reset_done.html | 4 ---- yaksh/templates/registration/password_reset_form.html | 12 ------------ yaksh/urls.py | 13 +++++++++++-- 13 files changed, 85 insertions(+), 76 deletions(-) create mode 100644 yaksh/templates/register/password_change_done.html create mode 100644 yaksh/templates/register/password_change_form.html create mode 100644 yaksh/templates/register/password_reset_complete.html create mode 100644 yaksh/templates/register/password_reset_confirm.html create mode 100644 yaksh/templates/register/password_reset_done.html create mode 100644 yaksh/templates/register/password_reset_form.html delete mode 100644 yaksh/templates/registration/password_change_done.html delete mode 100644 yaksh/templates/registration/password_change_form.html delete mode 100644 yaksh/templates/registration/password_reset_complete.html delete mode 100644 yaksh/templates/registration/password_reset_confirm.html delete mode 100644 yaksh/templates/registration/password_reset_done.html delete mode 100644 yaksh/templates/registration/password_reset_form.html diff --git a/yaksh/templates/register/password_change_done.html b/yaksh/templates/register/password_change_done.html new file mode 100644 index 0000000..fef07d1 --- /dev/null +++ b/yaksh/templates/register/password_change_done.html @@ -0,0 +1,16 @@ +{% extends "base.html" %} + +{% block title %}Password change successful{% endblock %} +{% block pagetitle %}Online Test {% endblock %} +{% block script %} + +{% endblock %} +{% block content %} +
Your password has been reset.
+ +{% endblock %} diff --git a/yaksh/templates/register/password_reset_confirm.html b/yaksh/templates/register/password_reset_confirm.html new file mode 100644 index 0000000..5566499 --- /dev/null +++ b/yaksh/templates/register/password_reset_confirm.html @@ -0,0 +1,17 @@ +{% extends "base.html" %} +{% block title %}Reset Password{% endblock %} +{% block pagetitle %} Online Test {% endblock %} +{% block formtitle %} Reset password {% endblock %} + +{% block content %} + {% if validlink %} +Please enter your new password twice so we can verify you typed it in correctly
. + + {% else %} +This reset link is no longer valid!
+ {% endif %} +{% endblock %} diff --git a/yaksh/templates/register/password_reset_done.html b/yaksh/templates/register/password_reset_done.html new file mode 100644 index 0000000..ace3cc9 --- /dev/null +++ b/yaksh/templates/register/password_reset_done.html @@ -0,0 +1,4 @@ +{% extends "base.html" %} +{% block title %}Password reset successful{% endblock %} +{% block pagetitle %} Online Test {% endblock %} +{% block formtitle %} Instruction for setting new password has been mailed to your registered email address {% endblock %} diff --git a/yaksh/templates/register/password_reset_form.html b/yaksh/templates/register/password_reset_form.html new file mode 100644 index 0000000..0dbaf09 --- /dev/null +++ b/yaksh/templates/register/password_reset_form.html @@ -0,0 +1,12 @@ +{% extends "base.html" %} +{% block title %} Forgot Password {% endblock %} +{% block pagetitle %} Online Test {% endblock %} +{% block formtitle %} Email will be send to the registered email address {% endblock %} +{% block content %} + +{% endblock content %} diff --git a/yaksh/templates/registration/password_change_done.html b/yaksh/templates/registration/password_change_done.html deleted file mode 100644 index fef07d1..0000000 --- a/yaksh/templates/registration/password_change_done.html +++ /dev/null @@ -1,16 +0,0 @@ -{% extends "base.html" %} - -{% block title %}Password change successful{% endblock %} -{% block pagetitle %}Online Test {% endblock %} -{% block script %} - -{% endblock %} -{% block content %} -Your password has been reset.
- -{% endblock %} diff --git a/yaksh/templates/registration/password_reset_confirm.html b/yaksh/templates/registration/password_reset_confirm.html deleted file mode 100644 index 5566499..0000000 --- a/yaksh/templates/registration/password_reset_confirm.html +++ /dev/null @@ -1,17 +0,0 @@ -{% extends "base.html" %} -{% block title %}Reset Password{% endblock %} -{% block pagetitle %} Online Test {% endblock %} -{% block formtitle %} Reset password {% endblock %} - -{% block content %} - {% if validlink %} -Please enter your new password twice so we can verify you typed it in correctly
. - - {% else %} -This reset link is no longer valid!
- {% endif %} -{% endblock %} diff --git a/yaksh/templates/registration/password_reset_done.html b/yaksh/templates/registration/password_reset_done.html deleted file mode 100644 index ace3cc9..0000000 --- a/yaksh/templates/registration/password_reset_done.html +++ /dev/null @@ -1,4 +0,0 @@ -{% extends "base.html" %} -{% block title %}Password reset successful{% endblock %} -{% block pagetitle %} Online Test {% endblock %} -{% block formtitle %} Instruction for setting new password has been mailed to your registered email address {% endblock %} diff --git a/yaksh/templates/registration/password_reset_form.html b/yaksh/templates/registration/password_reset_form.html deleted file mode 100644 index 0dbaf09..0000000 --- a/yaksh/templates/registration/password_reset_form.html +++ /dev/null @@ -1,12 +0,0 @@ -{% extends "base.html" %} -{% block title %} Forgot Password {% endblock %} -{% block pagetitle %} Online Test {% endblock %} -{% block formtitle %} Email will be send to the registered email address {% endblock %} -{% block content %} - -{% endblock content %} diff --git a/yaksh/urls.py b/yaksh/urls.py index 7a41f95..cd97dd4 100644 --- a/yaksh/urls.py +++ b/yaksh/urls.py @@ -6,18 +6,27 @@ from django.contrib.auth.views import password_reset, password_reset_confirm,\ # app_name = 'yaksh' urlpatterns = [ - url(r'^forgotpassword/$', password_reset, name="password_reset"), + url(r'^forgotpassword/$', password_reset, + {'template_name': 'register/password_reset_form.html'}, + name="password_reset"), url(r'^password_reset/(?P