Commit 18325b10 authored by okhin's avatar okhin
Browse files

Fixing the PEP8 issues

parent 7889f9f2
......@@ -8,5 +8,6 @@ def main():
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
if __name__ == "__main__":
main()
......@@ -94,6 +94,7 @@ def proposal_status_label(status, recommendation=None):
pattern = '<span class="label label-%s">%s</span>'
return mark_safe(pattern % (color, status))
@register.filter
def proposal_vote_icon(vote, recommendation=None):
color = 'muted'
......@@ -139,6 +140,7 @@ def cast_str(val):
def proposal_themes(proposal):
return set(proposal.themes.all()) | set(proposal.dossier.themes.all())
@register.filter
def getitem (item, index):
return item.get(index,'')
def getitem(item, index):
return item.get(index, '')
......@@ -5,7 +5,6 @@ import collections
from .dossier_detail_base import DossierDetailBase
from representatives_votes.models import Vote
from representatives.models import Representative
class DossierDetailVotes(DossierDetailBase):
......@@ -23,7 +22,8 @@ class DossierDetailVotes(DossierDetailBase):
votes_by_rep[vote.representative][vote.proposal] = vote
c['tab'] = 'votes'
c['proposals'] = c['object'].proposals.all().order_by('-datetime', 'title')
c['proposals'] = c['object'].proposals.all().order_by('-datetime',
'title')
c['votes_by_rep'] = votes_by_rep.items()
return c
......@@ -13,11 +13,11 @@ class RedirectGroupRepresentativeList(RedirectView):
if kwargs['group_kind'] == 'chamber':
chamber = Group.objects.get(kind='chamber', name=kwargs['group'])
return '%s?chamber=%s' % (reverse('representative-list'),
chamber.pk)
chamber.pk)
elif kwargs['group_kind'] == 'country':
country = Group.objects.get(kind='country', name=kwargs['group'])
return '%s?country=%s' % (reverse('representative-list'),
country.pk)
country.pk)
else:
group = Group.objects.get(kind=kwargs['group_kind'],
name=kwargs['group'])
......
......@@ -20,9 +20,12 @@ class RepresentativeViewMixin(object):
"""
Prefetch Mandates with their Group and Constituency with Country.
"""
mandates = Mandate.objects.order_by('-end_date', '-begin_date',
'group__kind', 'group__name').select_related('group',
'group__chamber', 'constituency__country')
mandates = Mandate.objects.order_by('-end_date',
'-begin_date',
'group__kind',
'group__name').select_related('group',
'group__chamber',
'constituency__country')
return queryset.prefetch_related(
models.Prefetch('mandates', queryset=mandates))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment