]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/views/readers.py
OSQA-587, filtering the questions QuerySet on the tag view if there is user parameter...
[osqa.git] / 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}),