diff options
author | adityacp | 2020-04-27 15:04:31 +0530 |
---|---|---|
committer | adityacp | 2020-04-27 15:31:37 +0530 |
commit | b8636965de8a86e68fd542754678e6826c7e5eac (patch) | |
tree | 638930dd42140d760e443c0d35874de6e27b3ef9 /yaksh/forms.py | |
parent | e3f73db877aaf2f6406bef39aee590530bcb503b (diff) | |
parent | 53a0c4ad3e733f3960000527f83565f2fd8fc412 (diff) | |
download | online_test-b8636965de8a86e68fd542754678e6826c7e5eac.tar.gz online_test-b8636965de8a86e68fd542754678e6826c7e5eac.tar.bz2 online_test-b8636965de8a86e68fd542754678e6826c7e5eac.zip |
Resolve conflicts in travis, requirements and views
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' + } + ) + } |