summaryrefslogtreecommitdiff
path: root/yaksh/views.py
diff options
context:
space:
mode:
authormahesh2017-06-09 16:13:24 +0530
committermahesh2017-06-14 12:45:07 +0530
commit3d43d3d423f6589688ba313ca961360280157543 (patch)
tree80403cdc82ae247931356377d96904a6e35dc456 /yaksh/views.py
parenta37b9b082ef9c89bd8f06844afad5db691e25995 (diff)
downloadonline_test-3d43d3d423f6589688ba313ca961360280157543.tar.gz
online_test-3d43d3d423f6589688ba313ca961360280157543.tar.bz2
online_test-3d43d3d423f6589688ba313ca961360280157543.zip
searches for tagged questions
Diffstat (limited to 'yaksh/views.py')
-rw-r--r--yaksh/views.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/yaksh/views.py b/yaksh/views.py
index 4096da3..42e92e0 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -1048,16 +1048,20 @@ def show_all_questions(request):
if request.POST.get('question_tags'):
question_tags = request.POST.getlist("question_tags")
- all_tags = []
+ search_tags = []
for tags in question_tags:
- all_tags.extend(re.split('[; |, |\*|\n]',tags))
- search_result = Question.objects.filter(tags__name__in=all_tags)\
- .distinct()
+ search_tags.extend(re.split('[; |, |\*|\n]',tags))
+ search_result = Question.objects.filter(tags__name__in=search_tags,
+ user=user).distinct()
context['search_result'] = search_result
questions = Question.objects.filter(user_id=user.id, active=True)
form = QuestionFilterForm(user=user)
+ user_tags = Question.objects.filter(user=user)\
+ .values_list('tags', flat=True).distinct()
+ all_tags = Tag.objects.filter(id__in = user_tags)
upload_form = UploadFileForm()
+ context['all_tags'] = all_tags
context['papers'] = []
context['question'] = None
context['questions'] = questions