diff options
author | King | 2018-07-12 07:00:27 -0700 |
---|---|---|
committer | GitHub | 2018-07-12 07:00:27 -0700 |
commit | 550d41f4ead0a7142e99f57096caef9555006fc0 (patch) | |
tree | 8ca9e928517964f74536deb1fc304114e19c5b6b /yaksh/forms.py | |
parent | a850749942d163f9aedb19a1d19c4b8d7016745d (diff) | |
parent | 7b268a2daf288fec1163d7f2322c4eb7575da78d (diff) | |
download | online_test-550d41f4ead0a7142e99f57096caef9555006fc0.tar.gz online_test-550d41f4ead0a7142e99f57096caef9555006fc0.tar.bz2 online_test-550d41f4ead0a7142e99f57096caef9555006fc0.zip |
Merge pull request #487 from adityacp/video_lessons_download
Download course content for offline view
Diffstat (limited to 'yaksh/forms.py')
-rw-r--r-- | yaksh/forms.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/yaksh/forms.py b/yaksh/forms.py index 99e8dbe..a51e6c2 100644 --- a/yaksh/forms.py +++ b/yaksh/forms.py @@ -325,7 +325,19 @@ class LessonForm(forms.ModelForm): class Meta: model = Lesson - exclude = ['completed_lessons', 'creator', 'html_data'] + exclude = ['creator', 'html_data'] + + def clean_video_file(self): + file = self.cleaned_data.get("video_file") + if file: + extension = file.name.split(".")[-1] + actual_extension = ["mp4", "ogv", "webm"] + if extension not in actual_extension: + raise forms.ValidationError( + "Please upload video files in {0} format".format( + ", ".join(actual_extension)) + ) + return file class LessonFileForm(forms.Form): |