forked from DGNum/gestioCOF
Plus d'infos + pluralisation
Sur la page des ratios par spectacle
This commit is contained in:
parent
4f66f161b0
commit
dc33160e0b
3 changed files with 13 additions and 10 deletions
|
@ -1,9 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import calendar
|
||||
import random
|
||||
from datetime import timedelta
|
||||
|
@ -53,7 +49,6 @@ class CategorieSpectacle(models.Model):
|
|||
verbose_name = "Catégorie"
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Spectacle(models.Model):
|
||||
title = models.CharField("Titre", max_length=300)
|
||||
category = models.ForeignKey(CategorieSpectacle, blank=True, null=True)
|
||||
|
|
|
@ -38,7 +38,10 @@
|
|||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<span class="bda-prix">Total : {{ total }} places demandées</span>
|
||||
<span class="bda-prix">
|
||||
Total : {{ total }} place{{ total|pluralize }} demandée{{ total|pluralize }}
|
||||
sur {{ proposed }} place{{ proposed|pluralize }} proposée{{ proposed|pluralize }}
|
||||
</span>
|
||||
<script type="text/javascript"
|
||||
src="{% static "js/jquery.min.js" %}"></script>
|
||||
<script type="text/javascript"
|
||||
|
|
13
bda/views.py
13
bda/views.py
|
@ -9,7 +9,7 @@ from datetime import timedelta
|
|||
from django.shortcuts import render, get_object_or_404
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.db import models, transaction
|
||||
from django.db.models import Count, Q
|
||||
from django.db.models import Count, Q, Sum
|
||||
from django.core import serializers, mail
|
||||
from django.forms.models import inlineformset_factory
|
||||
from django.http import HttpResponseBadRequest, HttpResponseRedirect
|
||||
|
@ -32,7 +32,7 @@ from bda.forms import BaseBdaFormSet, TokenForm, ResellForm, AnnulForm,\
|
|||
def etat_places(request, tirage_id):
|
||||
"""
|
||||
Résumé des spectacles d'un tirage avec pour chaque spectacle :
|
||||
- Le nombrede places en jeu
|
||||
- Le nombre de places en jeu
|
||||
- Le nombre de demandes
|
||||
- Le ratio demandes/places
|
||||
Et le total de toutes les demandes
|
||||
|
@ -69,8 +69,13 @@ def etat_places(request, tirage_id):
|
|||
spectacles_dict[spectacle["spectacle"]].total / \
|
||||
spectacles_dict[spectacle["spectacle"]].slots
|
||||
total += 2*spectacle["total"]
|
||||
return render(request, "bda/etat-places.html",
|
||||
{"spectacles": spectacles, "total": total, 'tirage': tirage})
|
||||
context = {
|
||||
"proposed": tirage.spectacle_set.aggregate(Sum('slots'))['slots__sum'],
|
||||
"spectacles": spectacles,
|
||||
"total": total,
|
||||
'tirage': tirage
|
||||
}
|
||||
return render(request, "bda/etat-places.html", context)
|
||||
|
||||
|
||||
def _hash_queryset(queryset):
|
||||
|
|
Loading…
Add table
Reference in a new issue