Commits

Anonymous committed 2c07731

Add more useful info to the context

Comments (0)

Files changed (1)

gnocchi/blog/views.py

     template_name = 'blog/post_list.html'
     allow_empty = True
 
+    def get_context_data(self, **kwargs):
+        return dict(
+            super(PostList, self).get_context_data(**kwargs),
+            most_common=self.model.tags.most_common(),
+            tags=self.request.GET.getlist('tags'),
+        )
+
 class PostDetail(PostMixin, DateDetailView):
     template_name = 'blog/post_detail.html'
     context_object_name = 'post'
         return self.render_to_response(context)
 
     def get_context_data(self, **kwargs):
-        context = super(PostDetail, self).get_context_data(**kwargs)
-        context['comment_form'] = forms.CommentForm(self._get_remote_ip(self.request))
-        return context
+        return dict(
+            super(PostDetail, self).get_context_data(**kwargs),
+            comment_form = forms.CommentForm(self._get_remote_ip(self.request)),
+        )