summaryrefslogtreecommitdiff
path: root/yaksh/models.py
diff options
context:
space:
mode:
authoradityacp2018-02-28 16:54:22 +0530
committeradityacp2018-02-28 16:58:03 +0530
commit3bbaff2ebca026042cce3deb025effb9e83e0859 (patch)
tree071dab1d0a4097a0243cb6b9baf9f917693ab40d /yaksh/models.py
parent438f8657021981fc7b2e5adbacc13eb332a2e6d3 (diff)
downloadonline_test-3bbaff2ebca026042cce3deb025effb9e83e0859.tar.gz
online_test-3bbaff2ebca026042cce3deb025effb9e83e0859.tar.bz2
online_test-3bbaff2ebca026042cce3deb025effb9e83e0859.zip
Change forms.py, models.py, test_models.py and templates
- Add help text for timezone field in user registration form - Add new method in course model to get days remaining to start a course - Show start time and end time of a course to the students - Disallow to enroll to a course which is not active - Add model test for the new course method
Diffstat (limited to 'yaksh/models.py')
-rw-r--r--yaksh/models.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index f065190..2e759ee 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -722,6 +722,14 @@ class Course(models.Model):
percent = round((count / len(modules)))
return percent
+ def days_remain_to_start(self):
+ """ Get the days remaining for the start of the course """
+ if timezone.now() < self.start_enroll_time:
+ remaining_days = (self.start_enroll_time - timezone.now()).days + 1
+ else:
+ remaining_days = 0
+ return remaining_days
+
def __str__(self):
return self.name