+@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)
+
+