diff options
author | Palaparthy Adityachandra | 2020-04-27 13:51:06 +0530 |
---|---|---|
committer | GitHub | 2020-04-27 13:51:06 +0530 |
commit | 53a0c4ad3e733f3960000527f83565f2fd8fc412 (patch) | |
tree | b3111bb5f317ec1ca12b173a3bce8b6a7e1b9c62 /yaksh/forms.py | |
parent | 01c9faa0abeedb748600c35a35bd6cf8124bd64d (diff) | |
parent | 2116310ed81ed81035a25ccc5746e8114b6a7b24 (diff) | |
download | online_test-53a0c4ad3e733f3960000527f83565f2fd8fc412.tar.gz online_test-53a0c4ad3e733f3960000527f83565f2fd8fc412.tar.bz2 online_test-53a0c4ad3e733f3960000527f83565f2fd8fc412.zip |
Merge pull request #690 from CruiseDevice/forum
Discussion Forum for Yaksh
Diffstat (limited to 'yaksh/forms.py')
-rw-r--r-- | yaksh/forms.py | 47 |
1 files changed, 44 insertions, 3 deletions
diff --git a/yaksh/forms.py b/yaksh/forms.py index 81b067c..216f5c2 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, Post, Comment ) from grades.models import GradingSystem from django.contrib.auth import authenticate @@ -32,7 +32,7 @@ test_case_types = ( ) status_types = ( - ('select','Select Status'), + ('select', 'Select Status'), ('active', 'Active'), ('closed', 'Inactive'), ) @@ -381,7 +381,7 @@ class SearchFilterForm(forms.Form): search_tags = forms.CharField( label='Search Tags', widget=forms.TextInput(attrs={'placeholder': 'Search', - 'class': form_input_class,}), + 'class': form_input_class, }), required=False ) search_status = forms.ChoiceField( @@ -571,3 +571,44 @@ class TestcaseForm(forms.ModelForm): class Meta: model = TestCase fields = ["type"] + + +class PostForm(forms.ModelForm): + class Meta: + model = Post + 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' + } + ) + } |