summaryrefslogtreecommitdiff
path: root/yaksh/forms.py
diff options
context:
space:
mode:
authorCruiseDevice2020-01-06 01:10:58 +0530
committerCruiseDevice2020-01-06 01:10:58 +0530
commit68aab21a767de33e9a798ca847bc788d7429507d (patch)
tree52bf204620a685fa4a331f57a5e06c8a596607b4 /yaksh/forms.py
parent0a74cf7b9f60cb5acafd5654d0543bbbbf26574f (diff)
downloadonline_test-68aab21a767de33e9a798ca847bc788d7429507d.tar.gz
online_test-68aab21a767de33e9a798ca847bc788d7429507d.tar.bz2
online_test-68aab21a767de33e9a798ca847bc788d7429507d.zip
Improve UI in addquestion template
Diffstat (limited to 'yaksh/forms.py')
-rw-r--r--yaksh/forms.py33
1 files changed, 32 insertions, 1 deletions
diff --git a/yaksh/forms.py b/yaksh/forms.py
index 951fcc1..def9c32 100644
--- a/yaksh/forms.py
+++ b/yaksh/forms.py
@@ -264,6 +264,33 @@ class QuestionForm(forms.ModelForm):
"""Creates a form to add or edit a Question.
It has the related fields and functions required."""
+ def __init__(self, *args, **kwargs):
+ super(QuestionForm, self).__init__(*args, **kwargs)
+ self.fields['summary'].widget.attrs.update(
+ {'class': form_input_class, 'placeholder': 'Summary'}
+ )
+ self.fields['language'].widget.attrs.update(
+ {'class': 'custom-select'}
+ )
+ self.fields['type'].widget.attrs.update(
+ {'class': 'custom-select'}
+ )
+ self.fields['description'].widget.attrs.update(
+ {'class': form_input_class, 'placeholder': 'Description'}
+ )
+ self.fields['tags'].widget.attrs.update(
+ {'class': form_input_class, 'placeholder': 'Tags'}
+ )
+ self.fields['solution'].widget.attrs.update(
+ {'class': form_input_class, 'placeholder': 'Solution'}
+ )
+ self.fields['snippet'].widget.attrs.update(
+ {'class': form_input_class, 'placeholder': 'Snippet'}
+ )
+ self.fields['min_time'].widget.attrs.update(
+ {'class': form_input_class}
+ )
+
class Meta:
model = Question
exclude = ['user', 'active']
@@ -271,7 +298,11 @@ class QuestionForm(forms.ModelForm):
class FileForm(forms.Form):
file_field = forms.FileField(widget=forms.ClearableFileInput(
- attrs={'multiple': True}),
+ attrs={
+ 'multiple': True,
+ 'class': 'custom-file-input'
+ }
+ ),
required=False)