- return question_list(request,
- Question.objects.filter(tags__name=unquote(tag)),
- mark_safe(_('questions tagged <span class="tag">%(tag)s</span>') % {'tag': tag}),
+ try:
+ tag = Tag.active.get(name=unquote(tag))
+ except Tag.DoesNotExist:
+ raise Http404
+
+ # Getting the questions QuerySet
+ questions = Question.objects.filter(tags__id=tag.id)
+
+ 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
+
+ # The extra tag context we need to pass
+ tag_context = {
+ 'tag' : tag,
+ }
+
+ # The context returned by the question_list function, contains info about the questions
+ question_context = question_list(request,
+ questions,
+ mark_safe(_(u'questions tagged <span class="tag">%(tag)s</span>') % {'tag': tag}),