forked from DGNum/gestioCOF
Fusion BdA
- Les tirages ont un champ `active` pour indiquer si le tirage doit être affiché ou considéré comme archivé. - La page d'accueil n'affiche que les tirages actifs. - Le formulaire d'inscription ne propose plus que les spectacles du tirage concerné.
This commit is contained in:
parent
366daf7240
commit
759893f728
4 changed files with 26 additions and 14 deletions
|
@ -12,6 +12,7 @@ class Tirage(models.Model):
|
||||||
ouverture = models.DateTimeField("Date et heure d'ouverture du tirage")
|
ouverture = models.DateTimeField("Date et heure d'ouverture du tirage")
|
||||||
fermeture = models.DateTimeField("Date et heure de fermerture du tirage")
|
fermeture = models.DateTimeField("Date et heure de fermerture du tirage")
|
||||||
token = models.TextField("Graine du tirage", blank=True)
|
token = models.TextField("Graine du tirage", blank=True)
|
||||||
|
active = models.BooleanField("Tirage actif", default=True)
|
||||||
|
|
||||||
def date_no_seconds(self):
|
def date_no_seconds(self):
|
||||||
return self.fermeture.strftime('%d %b %Y %H:%M')
|
return self.fermeture.strftime('%d %b %Y %H:%M')
|
||||||
|
|
10
bda/views.py
10
bda/views.py
|
@ -133,10 +133,16 @@ def inscription(request, tirage_id):
|
||||||
{ "error_title": "C'est fini !",
|
{ "error_title": "C'est fini !",
|
||||||
"error_description": u"Tirage au sort dans la journée !",
|
"error_description": u"Tirage au sort dans la journée !",
|
||||||
"choices": choices})
|
"choices": choices})
|
||||||
BdaFormSet = inlineformset_factory(Participant,
|
def formfield_callback(f, **kwargs):
|
||||||
|
if f.name == "spectacle":
|
||||||
|
kwargs['queryset'] = Spectacle.objects.filter(tirage=tirage)
|
||||||
|
return f.formfield(**kwargs)
|
||||||
|
BdaFormSet = inlineformset_factory(
|
||||||
|
Participant,
|
||||||
ChoixSpectacle,
|
ChoixSpectacle,
|
||||||
fields=("spectacle","double_choice","priority"),
|
fields=("spectacle","double_choice","priority"),
|
||||||
formset=BaseBdaFormSet)
|
formset=BaseBdaFormSet,
|
||||||
|
formfield_callback=formfield_callback)
|
||||||
participant, created = Participant.objects.get_or_create(
|
participant, created = Participant.objects.get_or_create(
|
||||||
user=request.user, tirage=tirage)
|
user=request.user, tirage=tirage)
|
||||||
success = False
|
success = False
|
||||||
|
|
|
@ -24,17 +24,19 @@
|
||||||
|
|
||||||
|
|
||||||
{% if user.profile.is_cof %}
|
{% if user.profile.is_cof %}
|
||||||
<h3>BdA</h3>
|
{% if open_tirages %}
|
||||||
|
<h3>Tirages du BdA</h3>
|
||||||
|
{% for tirage in open_tirages %}
|
||||||
<ul>
|
<ul>
|
||||||
Premier tirage
|
{{ tirage.title }}
|
||||||
<li><a href="{% url "bda-tirage-inscription" 1 %}">Inscription au premier tirage au sort du BdA</a></li>
|
<li><a href="{% url "bda-tirage-inscription" tirage.id %}">Inscription</a></li>
|
||||||
<li><a href="{% url "bda-etat-places" 1 %}">État des demandes</a>
|
<li><a href="{% url "bda-etat-places" tirage.id %}">État des demandes</a>
|
||||||
<li><a href="{% url "bda-places-attribuees" 1 %}">Mes places du premier tirage</a></li>
|
<li><a href="{% url "bda-places-attribuees" tirage.id %}">Mes places</a></li>
|
||||||
<li><a href="{% url "bda-revente" 1 %}">Revendre une place du premier tirage</a></li>
|
<li><a href="{% url "bda-revente" tirage.id %}">Revendre une place</a></li>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<h3>Divers</h3>
|
<h3>Divers</h3>
|
||||||
|
|
|
@ -20,14 +20,17 @@ from gestioncof.forms import UserProfileForm, EventStatusFilterForm, \
|
||||||
SurveyForm, SurveyStatusFilterForm, RegistrationUserForm, \
|
SurveyForm, SurveyStatusFilterForm, RegistrationUserForm, \
|
||||||
RegistrationProfileForm, AdminEventForm, EventForm
|
RegistrationProfileForm, AdminEventForm, EventForm
|
||||||
|
|
||||||
|
from bda.models import Tirage
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def home(request):
|
def home(request):
|
||||||
data = {"surveys": Survey.objects.filter(old = False).all(),
|
data = {"surveys": Survey.objects.filter(old=False).all(),
|
||||||
"events": Event.objects.filter(old = False).all(),
|
"events": Event.objects.filter(old=False).all(),
|
||||||
"open_surveys": Survey.objects.filter(survey_open = True, old = False).all(),
|
"open_surveys": Survey.objects.filter(survey_open=True, old=False).all(),
|
||||||
"open_events": Event.objects.filter(registration_open = True, old = False).all()}
|
"open_events": Event.objects.filter(registration_open=True, old=False).all(),
|
||||||
|
"open_tirages": Tirage.objects.filter(active=True).all()}
|
||||||
return render(request, "home.html", data)
|
return render(request, "home.html", data)
|
||||||
|
|
||||||
def login(request):
|
def login(request):
|
||||||
|
|
Loading…
Reference in a new issue