diff options
author | CruiseDevice | 2020-04-13 16:45:42 +0530 |
---|---|---|
committer | CruiseDevice | 2020-04-13 16:45:42 +0530 |
commit | 0e6c7d589114450d5cd1bc581ee1692c235f1a73 (patch) | |
tree | 3e1749b9695a708ac65deb5953d4913250335522 /yaksh/forms.py | |
parent | 2a9f81cb32acfd7a2efc18f58c4529b39ce4061b (diff) | |
download | online_test-0e6c7d589114450d5cd1bc581ee1692c235f1a73.tar.gz online_test-0e6c7d589114450d5cd1bc581ee1692c235f1a73.tar.bz2 online_test-0e6c7d589114450d5cd1bc581ee1692c235f1a73.zip |
Add feature for uploading images
Diffstat (limited to 'yaksh/forms.py')
-rw-r--r-- | yaksh/forms.py | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/yaksh/forms.py b/yaksh/forms.py index 52ef75d..e66c898 100644 --- a/yaksh/forms.py +++ b/yaksh/forms.py @@ -1,7 +1,7 @@ from django import forms from yaksh.models import ( get_model_class, Profile, Quiz, Question, Course, QuestionPaper, Lesson, - LearningModule, TestCase, languages, question_types + LearningModule, TestCase, languages, question_types, Thread, Comment ) from grades.models import GradingSystem from django.contrib.auth import authenticate @@ -552,3 +552,44 @@ class TestcaseForm(forms.ModelForm): class Meta: model = TestCase fields = ["type"] + + +class ThreadForm(forms.ModelForm): + class Meta: + model = Thread + fields = ["title", "description", "image"] + widgets = { + 'title': forms.TextInput( + attrs = { + 'class': 'form-control' + } + ), + 'description': forms.Textarea( + attrs = { + 'class': 'form-control' + } + ), + 'image': forms.FileInput( + attrs = { + 'class': 'form-control-file' + } + ) + } + + +class CommentForm(forms.ModelForm): + class Meta: + model = Comment + fields = ["description", "image"] + widgets = { + 'description': forms.Textarea( + attrs = { + 'class': 'form-control' + } + ), + 'image': forms.FileInput( + attrs = { + 'class': 'form-control-file' + } + ) + } |