Browse Source

Merge pull request 'Fixes' (#55) from fpoulain/gvot:colleges into master

Reviewed-on: #55
master
François Poulain 6 months ago
parent
commit
321afe00ae
  1. 8
      gvot/base/models.py
  2. 3
      gvot/base/views.py
  3. 2
      gvot/templates/modeladmin/index_results.html

8
gvot/base/models.py

@ -490,11 +490,13 @@ class Scrutin(RoutablePageMixin, AbstractEmailForm): @@ -490,11 +490,13 @@ class Scrutin(RoutablePageMixin, AbstractEmailForm):
self.save()
def pouvoirs_champs_persos(self):
return list(
self.pouvoir_set.values_list(
return [
v
for v in self.pouvoir_set.values_list(
'champ_perso__intitule', flat=True
).distinct()
)
if v is not None
]
def context_values(self):
return {

3
gvot/base/views.py

@ -654,6 +654,9 @@ class ScrutinResults(AdminMixin, CSVExportMixin, detail.DetailView): @@ -654,6 +654,9 @@ class ScrutinResults(AdminMixin, CSVExportMixin, detail.DetailView):
context['can_split_by'] = self.can_split_by
context['split_by'] = self.verbose_split_by
context['results'] = self.object.get_results(context['split_by'])
context['has_results'] = any(
[p['participation'] for _, _, p in context['results']]
)
return context
def dispatch(self, request, *args, **kwargs):

2
gvot/templates/modeladmin/index_results.html

@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
</div>
</header>
<div class="nice-padding">
{% if results %}
{% if has_results %}
<div class="overflow">
{% for header, listing, participation in results %}
{% if listing %}

Loading…
Cancel
Save
Map all the world