diff options
author | adityacp | 2018-07-10 15:47:46 +0530 |
---|---|---|
committer | adityacp | 2018-07-10 15:47:46 +0530 |
commit | c075bc00bc57507f2af4d47f7f2e5e063df6921a (patch) | |
tree | 79cbae95ddcaa6bbfa7cd47944e249f9b242464d /yaksh/models.py | |
parent | 5bd270e21bfdf08bd73940bf471ebcf566fb9de6 (diff) | |
download | online_test-c075bc00bc57507f2af4d47f7f2e5e063df6921a.tar.gz online_test-c075bc00bc57507f2af4d47f7f2e5e063df6921a.tar.bz2 online_test-c075bc00bc57507f2af4d47f7f2e5e063df6921a.zip |
Change in file_utils, forms, models, lesson.css, add_lesson.html, views
- Add new function in the file_utils to render template
- Add webm as supported video format in forms
- Add help text in video_file field
- Add lesson.css file for adding custom styling for lessons
- Add static_files dict in download_course views function
Diffstat (limited to 'yaksh/models.py')
-rw-r--r-- | yaksh/models.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/yaksh/models.py b/yaksh/models.py index 34aee25..464eeb5 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -166,9 +166,11 @@ class Lesson(models.Model): active = models.BooleanField(default=True) # A video file - video_file = models.FileField(upload_to=get_file_dir, default=None, - null=True, blank=True - ) + video_file = models.FileField( + upload_to=get_file_dir, default=None, + null=True, blank=True, + help_text="Please upload video files in mp4, ogv, webm format" + ) def __str__(self): return "{0}".format(self.name) @@ -882,13 +884,14 @@ class Course(models.Model): def is_student(self, user): return user in self.students.all() - def create_zip(self, path): + def create_zip(self, path, static_files): zip_file_name = string_io() with zipfile.ZipFile(zip_file_name, "a") as zip_file: course_name = self.name.replace(" ", "_") modules = self.get_learning_modules() file_path = os.sep.join((path, "templates", "yaksh", "index.html")) - write_static_files_to_zip(zip_file, course_name, path) + write_static_files_to_zip(zip_file, course_name, path, + static_files) course_data = {"course": self, "modules": modules} write_templates_to_zip(zip_file, file_path, course_data, "index", course_name) |