- return question_list(request, Question.objects.filter(tags__name=unquote(tag)),
- list_description=mark_safe(_('Questions tagged <span class="tag">%(tag)s</span>') % {'tag': tag}),
- page_title=mark_safe(_('Questions tagged %(tag)s') % {'tag': tag}),
- allowIgnoreTags=False)
+ return question_list(request,
+ Question.objects.filter(tags__name=unquote(tag)),
+ mark_safe(_('questions tagged <span class="tag">%(tag)s</span>') % {'tag': tag}),
+ request.utils.set_sort_method('active'),
+ None,
+ mark_safe(_('Questions Tagged With %(tag)s') % {'tag': tag}),
+ False)
+
+@decorators.render('questions.html', 'questions', tabbed=False)
+def user_questions(request, mode, user, slug):
+ user = get_object_or_404(User, id=user)
+
+ if mode == _('asked-by'):
+ questions = Question.objects.filter(author=user)
+ description = _("Questions asked by %s")
+ elif mode == _('answered-by'):
+ questions = Question.objects.filter(children__author=user, children__node_type='answer').distinct()
+ description = _("Questions answered by %s")
+ elif mode == _('subscribed-by'):
+ if not (request.user.is_superuser or request.user == user):
+ return HttpResponseUnauthorized(request)
+ questions = user.subscriptions
+
+ if request.user == user:
+ description = _("Questions you subscribed %s")
+ else:
+ description = _("Questions subscribed by %s")
+ else:
+ raise Http404
+
+
+ return question_list(request, questions,
+ mark_safe(description % hyperlink(user.get_profile_url(), user.username)),
+ request.utils.set_sort_method('active'),
+ page_title=description % user.username)
+