]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/views/readers.py
Resolves Jira-735, take another approach to merge the two dicts
[osqa.git] / forum / views / readers.py
index d757e51da1bca65df3b3f35b23ba731840d3b90e..8dad7801a1720afc8b0a7c551a5fc6676f5a650b 100644 (file)
@@ -113,12 +113,23 @@ 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 = dict(question_list(request,
                          questions,
                          mark_safe(_(u'questions tagged <span class="tag">%(tag)s</span>') % {'tag': tag}),
                          None,
                          mark_safe(_(u'Questions Tagged With %(tag)s') % {'tag': tag}),
-                         False)
+                         False))
+
+    # 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):
@@ -185,16 +196,19 @@ 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,
+    }
+
+    return pagination.paginated(request,
+                               ('questions', paginator_context or QuestionListPaginatorContext()), context)
 
 
 def search(request):