diff options
Diffstat (limited to 'yaksh/views.py')
-rw-r--r-- | yaksh/views.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/yaksh/views.py b/yaksh/views.py index c10ba6a..4096da3 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -29,6 +29,7 @@ try: from StringIO import StringIO as string_io except ImportError: from io import BytesIO as string_io +import re # Local imports. from yaksh.models import get_model_class, Quiz, Question, QuestionPaper, QuestionSet, Course from yaksh.models import Profile, Answer, AnswerPaper, User, TestCase, FileUpload,\ @@ -1045,6 +1046,15 @@ def show_all_questions(request): else: context["msg"] = "Please select atleast one question to test" + if request.POST.get('question_tags'): + question_tags = request.POST.getlist("question_tags") + all_tags = [] + for tags in question_tags: + all_tags.extend(re.split('[; |, |\*|\n]',tags)) + search_result = Question.objects.filter(tags__name__in=all_tags)\ + .distinct() + context['search_result'] = search_result + questions = Question.objects.filter(user_id=user.id, active=True) form = QuestionFilterForm(user=user) upload_form = UploadFileForm() |