theme_detail_positions.py 628 Bytes
Newer Older
Nicolas Joyard's avatar
Nicolas Joyard committed
1
2
3
4
5
6
7
8
9
10
# coding: utf-8

from .theme_detail_base import ThemeDetailBase


class ThemeDetailPositions(ThemeDetailBase):
    template_name = 'memopol_themes/theme_detail_positions.html'

    def get_queryset(self):
        qs = super(ThemeDetailPositions, self).get_queryset()
11
        qs = qs.prefetch_related('positions__representative',
12
                                 'positions__position_score')
Nicolas Joyard's avatar
Nicolas Joyard committed
13
14
15
16
17
18
19
20
21
        return qs

    def get_context_data(self, **kwargs):
        c = super(ThemeDetailPositions, self).get_context_data(**kwargs)

        c['tab'] = 'positions'
        c['positions'] = c['object'].positions.all()

        return c