Merge branch 'master' into Kerl/mails_rappel

This commit is contained in:
Martin Pépin 2016-06-11 00:28:00 +02:00
commit 1c4cf9a7ea
3 changed files with 16 additions and 4 deletions

View file

@ -52,6 +52,7 @@ class ParticipantAdmin(admin.ModelAdmin):
actions = ['send_attribs',]
actions_on_bottom = True
list_per_page = 400
readonly_fields = ("total",)
def send_attribs(self, request, queryset):
for member in queryset.all():
@ -142,9 +143,16 @@ class SpectacleAdmin(admin.ModelAdmin):
list_filter = ("location",)
search_fields = ("title", "location__name")
class TirageAdmin(admin.ModelAdmin):
model = Tirage
list_display = ("title", "ouverture", "fermeture", "active")
readonly_fields = ("token", )
list_filter = ("active", )
search_fields = ("title", )
admin.site.register(Spectacle, SpectacleAdmin)
admin.site.register(Salle)
admin.site.register(Participant, ParticipantAdmin)
admin.site.register(Attribution, AttributionAdmin)
admin.site.register(ChoixSpectacle, ChoixSpectacleAdmin)
admin.site.register(Tirage)
admin.site.register(Tirage, TirageAdmin)

View file

@ -1,5 +1,7 @@
# coding: utf-8
from __future__ import division
from django.conf import settings
from django.db.models import Max
@ -62,7 +64,7 @@ class Algorithm(object):
def __call__(self, seed):
random.seed(seed)
results = []
shows = sorted(self.shows, key = lambda x: float(x.nrequests) / x.slots, reverse = True)
shows = sorted(self.shows, key = lambda x: x.nrequests / x.slots, reverse = True)
for show in shows:
# On regroupe tous les gens ayant le même rang
groups = dict([(i, []) for i in range(1, self.max_group + 1)])

View file

@ -1,5 +1,7 @@
# coding: utf-8
from __future__ import division
from django.contrib.auth.models import User
from django.shortcuts import render, get_object_or_404
from django.contrib.auth.decorators import login_required
@ -50,13 +52,13 @@ def etat_places(request, tirage_id):
spectacles_dict[spectacle["spectacle"]].total += spectacle["total"]
spectacles_dict[spectacle["spectacle"]].ratio = \
spectacles_dict[spectacle["spectacle"]].total / \
float(spectacles_dict[spectacle["spectacle"]].slots)
spectacles_dict[spectacle["spectacle"]].slots
total += spectacle["total"]
for spectacle in spectacles2:
spectacles_dict[spectacle["spectacle"]].total += 2*spectacle["total"]
spectacles_dict[spectacle["spectacle"]].ratio = \
spectacles_dict[spectacle["spectacle"]].total / \
float(spectacles_dict[spectacle["spectacle"]].slots)
spectacles_dict[spectacle["spectacle"]].slots
total += spectacle["total"]
return render(request, "etat-places.html",
{"spectacles": spectacles, "total": total, 'tirage': tirage})