Commit c180bfa702524d474c448564dd31181148bc61e9
1 parent
b3cf1297
Exists in
master
and in
2 other branches
Changed visualize view
Showing
1 changed file
with
5 additions
and
4 deletions
Show diff stats
news/views.py
... | ... | @@ -19,12 +19,13 @@ class VisualizeNews(LoginRequiredMixin,LogMixin,generic.ListView): |
19 | 19 | |
20 | 20 | def get_context_data(self, **kwargs): |
21 | 21 | context = super(VisualizeNews, self).get_context_data(**kwargs) |
22 | - slug = self.kwargs.get('slug', '') | |
23 | - news = News.objects.get(slug=slug) | |
24 | - context['news'] = news | |
22 | + context['title'] = _('Visualize News') | |
25 | 23 | |
26 | 24 | return context |
27 | - | |
25 | + def get_queryset(self): | |
26 | + slug = self.kwargs.get('slug', '') | |
27 | + news = News.objects.get(slug=slug) | |
28 | + return news | |
28 | 29 | class ListNewsView(LoginRequiredMixin,LogMixin,generic.ListView): |
29 | 30 | login_url = reverse_lazy("users:login") |
30 | 31 | redirect_field_name = 'next' | ... | ... |