]> git.openstreetmap.org Git - osqa.git/commitdiff
OSQA-587, filtering the questions QuerySet on the tag view if there is user parameter...
authorjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Sun, 27 Mar 2011 22:12:51 +0000 (22:12 +0000)
committerjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Sun, 27 Mar 2011 22:12:51 +0000 (22:12 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@907 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/views/readers.py

index cad081a83f621363c8b01a3621274a0901d20a5a..0ef481ec4b8ccdc398c0ad84c0e8facb76118a06 100644 (file)
@@ -106,8 +106,20 @@ def tag(request, tag):
     except Tag.DoesNotExist:
         raise Http404
 
+    # Getting the questions QuerySet
+    questions = Question.objects.filter(tags=tag)
+
+    if request.method == "GET":
+        user = request.GET.get('user', None)
+
+        if user is not None:
+            try:
+                questions = questions.filter(author=User.objects.get(username=user))
+            except User.DoesNotExist:
+                raise Http404
+
     return question_list(request,
-                         Question.objects.filter(tags=tag),
+                         questions,
                          mark_safe(_('questions tagged <span class="tag">%(tag)s</span>') % {'tag': tag}),
                          None,
                          mark_safe(_('Questions Tagged With %(tag)s') % {'tag': tag}),