Merge branch 'master' into Kerl/mails_rappel
This commit is contained in:
commit
1c4cf9a7ea
3 changed files with 16 additions and 4 deletions
10
bda/admin.py
10
bda/admin.py
|
@ -52,6 +52,7 @@ class ParticipantAdmin(admin.ModelAdmin):
|
||||||
actions = ['send_attribs',]
|
actions = ['send_attribs',]
|
||||||
actions_on_bottom = True
|
actions_on_bottom = True
|
||||||
list_per_page = 400
|
list_per_page = 400
|
||||||
|
readonly_fields = ("total",)
|
||||||
|
|
||||||
def send_attribs(self, request, queryset):
|
def send_attribs(self, request, queryset):
|
||||||
for member in queryset.all():
|
for member in queryset.all():
|
||||||
|
@ -142,9 +143,16 @@ class SpectacleAdmin(admin.ModelAdmin):
|
||||||
list_filter = ("location",)
|
list_filter = ("location",)
|
||||||
search_fields = ("title", "location__name")
|
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(Spectacle, SpectacleAdmin)
|
||||||
admin.site.register(Salle)
|
admin.site.register(Salle)
|
||||||
admin.site.register(Participant, ParticipantAdmin)
|
admin.site.register(Participant, ParticipantAdmin)
|
||||||
admin.site.register(Attribution, AttributionAdmin)
|
admin.site.register(Attribution, AttributionAdmin)
|
||||||
admin.site.register(ChoixSpectacle, ChoixSpectacleAdmin)
|
admin.site.register(ChoixSpectacle, ChoixSpectacleAdmin)
|
||||||
admin.site.register(Tirage)
|
admin.site.register(Tirage, TirageAdmin)
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
|
||||||
|
from __future__ import division
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db.models import Max
|
from django.db.models import Max
|
||||||
|
|
||||||
|
@ -62,7 +64,7 @@ class Algorithm(object):
|
||||||
def __call__(self, seed):
|
def __call__(self, seed):
|
||||||
random.seed(seed)
|
random.seed(seed)
|
||||||
results = []
|
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:
|
for show in shows:
|
||||||
# On regroupe tous les gens ayant le même rang
|
# On regroupe tous les gens ayant le même rang
|
||||||
groups = dict([(i, []) for i in range(1, self.max_group + 1)])
|
groups = dict([(i, []) for i in range(1, self.max_group + 1)])
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
|
||||||
|
from __future__ import division
|
||||||
|
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.shortcuts import render, get_object_or_404
|
from django.shortcuts import render, get_object_or_404
|
||||||
from django.contrib.auth.decorators import login_required
|
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"]].total += spectacle["total"]
|
||||||
spectacles_dict[spectacle["spectacle"]].ratio = \
|
spectacles_dict[spectacle["spectacle"]].ratio = \
|
||||||
spectacles_dict[spectacle["spectacle"]].total / \
|
spectacles_dict[spectacle["spectacle"]].total / \
|
||||||
float(spectacles_dict[spectacle["spectacle"]].slots)
|
spectacles_dict[spectacle["spectacle"]].slots
|
||||||
total += spectacle["total"]
|
total += spectacle["total"]
|
||||||
for spectacle in spectacles2:
|
for spectacle in spectacles2:
|
||||||
spectacles_dict[spectacle["spectacle"]].total += 2*spectacle["total"]
|
spectacles_dict[spectacle["spectacle"]].total += 2*spectacle["total"]
|
||||||
spectacles_dict[spectacle["spectacle"]].ratio = \
|
spectacles_dict[spectacle["spectacle"]].ratio = \
|
||||||
spectacles_dict[spectacle["spectacle"]].total / \
|
spectacles_dict[spectacle["spectacle"]].total / \
|
||||||
float(spectacles_dict[spectacle["spectacle"]].slots)
|
spectacles_dict[spectacle["spectacle"]].slots
|
||||||
total += spectacle["total"]
|
total += spectacle["total"]
|
||||||
return render(request, "etat-places.html",
|
return render(request, "etat-places.html",
|
||||||
{"spectacles": spectacles, "total": total, 'tirage': tirage})
|
{"spectacles": spectacles, "total": total, 'tirage': tirage})
|
||||||
|
|
Loading…
Reference in a new issue