From 8835afbc95c1a398cf62da7880596e7a302ae148 Mon Sep 17 00:00:00 2001 From: manojvaghela Date: Wed, 18 Mar 2020 16:36:52 +0530 Subject: Search bar added --- yaksh/forms.py | 19 +++++++++ yaksh/templates/yaksh/courses.html | 28 +++++++++++- yaksh/templates/yaksh/lessons.html | 30 ++++++++++++- yaksh/templates/yaksh/modules.html | 30 ++++++++++++- yaksh/templates/yaksh/quizzes.html | 30 ++++++++++++- yaksh/views.py | 87 +++++++++++++++++++++++++++++++++++--- 6 files changed, 212 insertions(+), 12 deletions(-) diff --git a/yaksh/forms.py b/yaksh/forms.py index 7d5362b..c0f40ea 100644 --- a/yaksh/forms.py +++ b/yaksh/forms.py @@ -49,6 +49,12 @@ test_case_types = ( ("floattestcase", "Float Testcase"), ) +status_types = ( + ('select','Select Status'), + ('active', 'Active'), + ('closed', 'Inactive'), + ) + UNAME_CHARS = letters + "._" + digits PWD_CHARS = letters + punctuation + digits @@ -377,6 +383,19 @@ class QuestionFilterForm(forms.Form): ) +class SearchFilterForm(forms.Form): + search_tags = forms.CharField( + label='Search Tags', + widget=forms.TextInput(attrs={'placeholder': 'Search', + 'class': form_input_class,}), + required=False + ) + search_status = forms.CharField(max_length=16, widget=forms.Select( + choices=status_types, + attrs={'class': 'custom-select'}), + ) + + class CourseForm(forms.ModelForm): """ course form for moderators """ class Meta: diff --git a/yaksh/templates/yaksh/courses.html b/yaksh/templates/yaksh/courses.html index 0eb9a38..cc4c69f 100644 --- a/yaksh/templates/yaksh/courses.html +++ b/yaksh/templates/yaksh/courses.html @@ -61,6 +61,32 @@ {% else %}