summaryrefslogtreecommitdiff
path: root/yaksh/forms.py
diff options
context:
space:
mode:
authoradityacp2020-01-20 19:11:19 +0530
committeradityacp2020-01-20 19:11:19 +0530
commite828d40b75181a2356fb9223280a1e6860a7ec49 (patch)
tree3a5f55d16a9773255b019957ee1b2cffb7a964d6 /yaksh/forms.py
parentf988c72e19b689227d671b6774242bb3e784a5e2 (diff)
downloadonline_test-e828d40b75181a2356fb9223280a1e6860a7ec49.tar.gz
online_test-e828d40b75181a2356fb9223280a1e6860a7ec49.tar.bz2
online_test-e828d40b75181a2356fb9223280a1e6860a7ec49.zip
Change views, urls, forms, templates, static
- Change course, quiz, module, lesson forms - Add messages for success and warning - Add proper redirections to the specifc urls - Remove unnecessary custom css
Diffstat (limited to 'yaksh/forms.py')
-rw-r--r--yaksh/forms.py51
1 files changed, 45 insertions, 6 deletions
diff --git a/yaksh/forms.py b/yaksh/forms.py
index 951fcc1..5a3925e 100644
--- a/yaksh/forms.py
+++ b/yaksh/forms.py
@@ -228,6 +228,34 @@ class QuizForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(QuizForm, self).__init__(*args, **kwargs)
+ self.fields['start_date_time'].widget.attrs.update(
+ {'class': form_input_class}
+ )
+ self.fields['end_date_time'].widget.attrs.update(
+ {'class': form_input_class}
+ )
+ self.fields['duration'].widget.attrs.update(
+ {'class': form_input_class}
+ )
+ self.fields['description'].widget.attrs.update(
+ {'class': form_input_class}
+ )
+ self.fields['attempts_allowed'].widget.attrs.update(
+ {'class': 'custom-select'}
+ )
+ self.fields['time_between_attempts'].widget.attrs.update(
+ {'class': form_input_class}
+ )
+ self.fields['instructions'].widget.attrs.update(
+ {'class': form_input_class}
+ )
+ self.fields['weightage'].widget.attrs.update(
+ {'class': form_input_class}
+ )
+ self.fields['pass_criteria'].widget.attrs.update(
+ {'class': form_input_class}
+ )
+
self.fields["instructions"].initial = dedent("""\
<p>
This examination system has been developed with the intention of
@@ -415,9 +443,15 @@ class LessonForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(LessonForm, self).__init__(*args, **kwargs)
des_msg = "Enter Lesson Description as Markdown text"
- name_msg = "Enter Lesson Name"
- self.fields['description'].widget.attrs['placeholder'] = des_msg
- self.fields['name'].widget.attrs['placeholder'] = name_msg
+ self.fields['name'].widget.attrs.update(
+ {'class': form_input_class, 'placeholder': 'Lesson Name'}
+ )
+ self.fields['description'].widget.attrs.update(
+ {'class': form_input_class, 'placeholder': des_msg}
+ )
+ self.fields['video_file'].widget.attrs.update(
+ {'class': "custom-file-input"}
+ )
class Meta:
model = Lesson
@@ -438,16 +472,21 @@ class LessonForm(forms.ModelForm):
class LessonFileForm(forms.Form):
Lesson_files = forms.FileField(widget=forms.ClearableFileInput(
- attrs={'multiple': True}),
+ attrs={'multiple': True,
+ 'class': "custom-file-input"}),
required=False)
class LearningModuleForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(LearningModuleForm, self).__init__(*args, **kwargs)
- name_msg = "Enter Learning Module Name"
- self.fields['name'].widget.attrs['placeholder'] = name_msg
self.fields['name'].widget.attrs['size'] = 30
+ self.fields['name'].widget.attrs.update(
+ {'class': form_input_class, 'placeholder': 'Module Name'}
+ )
+ self.fields['description'].widget.attrs.update(
+ {'class': form_input_class, 'placeholder': 'Module Description'}
+ )
class Meta:
model = LearningModule