X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/f1defc59ca7a7b15e17e8a59c72a726ae937d8e5..9aff9f20a59714803bae4c4741cc52995eff2a3a:/forum/views/readers.py diff --git a/forum/views/readers.py b/forum/views/readers.py index d757e51..99233e8 100644 --- a/forum/views/readers.py +++ b/forum/views/readers.py @@ -113,13 +113,30 @@ def tag(request, tag): except User.DoesNotExist: raise Http404 - return question_list(request, + # 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 %(tag)s') % {'tag': tag}), None, mark_safe(_(u'Questions Tagged With %(tag)s') % {'tag': tag}), False) + # If the return data type is not a dict just return it + if not isinstance(question_context, dict): + return question_context + + question_context = dict(question_context) + + # Create the combined context + context = dict(question_context.items() + tag_context.items()) + + return context + @decorators.render('questions.html', 'questions', tabbed=False) def user_questions(request, mode, user, slug): user = get_object_or_404(User, id=user) @@ -155,7 +172,8 @@ def question_list(request, initial, feed_url=None, paginator_context=None, feed_sort=('-added_at',), - feed_req_params_exclude=(_('page'), _('pagesize'), _('sort'))): + feed_req_params_exclude=(_('page'), _('pagesize'), _('sort')), + extra_context={}): questions = initial.filter_state(deleted=False) @@ -185,16 +203,20 @@ def question_list(request, initial, feed_url = request.path + "?type=rss" + req_params - return pagination.paginated(request, ('questions', paginator_context or QuestionListPaginatorContext()), { - "questions" : questions.distinct(), - "questions_count" : questions.count(), - "keywords" : keywords, - "list_description": list_description, - "base_path" : base_path, - "page_title" : page_title, - "tab" : "questions", - 'feed_url': feed_url, - }) + context = { + 'questions' : questions.distinct(), + 'questions_count' : questions.count(), + 'keywords' : keywords, + 'list_description': list_description, + 'base_path' : base_path, + 'page_title' : page_title, + 'tab' : 'questions', + 'feed_url': feed_url, + } + context.update(extra_context) + + return pagination.paginated(request, + ('questions', paginator_context or QuestionListPaginatorContext()), context) def search(request):