Réparation des dernières vues
- Les liens utiles du BdA affichent tous les tirages en cours. - La listes des spectacles s'affiche
This commit is contained in:
parent
8266afd6ac
commit
9728384629
5 changed files with 32 additions and 19 deletions
|
@ -3,9 +3,9 @@
|
|||
{% block realcontent %}
|
||||
<h1><strong>Spectacles</strong></h1>
|
||||
<ul>
|
||||
<li><a href="{% url 'bda-unpaid' tirage.id %}">Pas payé</a></li>
|
||||
<li><a href="{% url 'bda-unpaid' tirage_id %}">Pas payé</a></li>
|
||||
{% for spectacle in object_list %}
|
||||
<li><a href="{% url 'bda-spectacle' tirage_id=tirage.id spectacle_id=spectacle.id %}">{{ spectacle }}</a></li>
|
||||
<li><a href="{% url 'bda-spectacle' tirage_id spectacle.id %}">{{ spectacle }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
|
19
bda/views.py
19
bda/views.py
|
@ -11,6 +11,7 @@ import hashlib
|
|||
|
||||
from django.core.mail import send_mail
|
||||
from django.utils import timezone
|
||||
from django.views.generic.list import ListView
|
||||
|
||||
from datetime import timedelta
|
||||
import time
|
||||
|
@ -299,18 +300,32 @@ def spectacle(request, tirage_id, spectacle_id):
|
|||
spectacle = get_object_or_404(Spectacle, id = spectacle_id, tirage=tirage)
|
||||
return render(request, "bda-emails.html", {"spectacle": spectacle})
|
||||
|
||||
|
||||
class SpectacleListView(ListView):
|
||||
model = Spectacle
|
||||
template_name = 'spectacle_list.html'
|
||||
def get_queryset(self):
|
||||
self.tirage = get_object_or_404(Tirage, id=self.kwargs['tirage_id'])
|
||||
categories = Spectacle.objects.filter(tirage=self.tirage)
|
||||
return categories
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(SpectacleListView, self).get_context_data(**kwargs)
|
||||
context['tirage_id'] = self.tirage.id
|
||||
return context
|
||||
|
||||
@buro_required
|
||||
def unpaid(request, tirage_id):
|
||||
tirage = get_object_or_404(Tirage, id=tirage_id)
|
||||
unpaid = Participants.objects.filter(tirage=tirage, paid=False).all()
|
||||
unpaid = Participant.objects.filter(tirage=tirage, paid=False).all()
|
||||
return render(request, "bda-unpaid.html", {"unpaid": unpaid})
|
||||
|
||||
@buro_required
|
||||
def liste_spectacles_ics(request, tirage_id):
|
||||
tirage = get_object_or_404(Tirage, id=tirage_id)
|
||||
spectacles = Spectacle.objects.filter(tirage=tirage).order_by("date").all()
|
||||
for spectacle in spectacles:
|
||||
spectacle.dtend = spectacle.date + timedelta(seconds=7200)
|
||||
return render(request, "liste_spectacles.ics",
|
||||
{ "spectacles": spectacles, "tirage": tirage},
|
||||
{"spectacles": spectacles, "tirage": tirage},
|
||||
content_type="text/calendar")
|
||||
|
||||
|
|
12
cof/urls.py
12
cof/urls.py
|
@ -6,9 +6,9 @@ autocomplete_light.autodiscover()
|
|||
from django.contrib import admin
|
||||
admin.autodiscover()
|
||||
|
||||
from django.views.generic.list import ListView
|
||||
from django.views.generic.base import TemplateView
|
||||
from bda.models import Spectacle
|
||||
from bda.views import SpectacleListView
|
||||
from gestioncof.petits_cours_views import DemandeListView
|
||||
|
||||
urlpatterns = patterns('',
|
||||
|
@ -40,22 +40,16 @@ urlpatterns = patterns('',
|
|||
url(r'^petitcours/demandes/(?P<demande_id>\d+)$', 'gestioncof.petits_cours_views.details', name = 'petits-cours-demande-details'),
|
||||
url(r'^petitcours/demandes/(?P<demande_id>\d+)/traitement$', 'gestioncof.petits_cours_views.traitement', name = 'petits-cours-demande-traitement'),
|
||||
url(r'^petitcours/demandes/(?P<demande_id>\d+)/retraitement$', 'gestioncof.petits_cours_views.retraitement', name = 'petits-cours-demande-retraitement'),
|
||||
|
||||
url(r'^bda/inscription/(?P<tirage_id>\d+)$', 'bda.views.inscription', name = 'bda-tirage-inscription'),
|
||||
url(r'^bda/places/(?P<tirage_id>\d+)$', 'bda.views.places', name = "bda-places-attribuees"),
|
||||
url(r'^bda/places/(?P<tirage_id>\d+)/places_bda.ics$', 'bda.views.places_ics', name = "bda-places-attribuees-ics"),
|
||||
url(r'^bda/revente/(?P<tirage_id>\d+)$', 'bda.views.revente', name = 'bda-revente'),
|
||||
url(r'^bda/etat-places/(?P<tirage_id>\d+)$', 'bda.views.etat_places', name = 'bda-etat-places'),
|
||||
url(r'^bda/tirage/(?P<tirage_id>\d+)$', 'bda.views.tirage'),
|
||||
# FIXME
|
||||
url(r'^bda/spectacles/(?P<tirage_id>\d+)$', lambda request, tirage_id:
|
||||
ListView(model=Spectacle,
|
||||
queryset=Spectacle.objects.filter(tirage__id=tirage_id)
|
||||
), name ="bda-liste-spectacles"),
|
||||
url(r'^bda/spectacles/(?P<tirage_id>\d+)$', SpectacleListView.as_view() , name ="bda-liste-spectacles"),
|
||||
url(r'^bda/spectacles/(?P<tirage_id>\d+)/(?P<spectacle_id>\d+)$', "bda.views.spectacle", name = "bda-spectacle"),
|
||||
url(r'^bda/spectacles-ics/(?P<tirage_id>\d+)$', 'bda.views.liste_spectacles_ics', name ="bda-liste-spectacles-ics"),
|
||||
url(r'^bda/spectacles/unpaid(?P<tirage_id>\d+)$', "bda.views.unpaid", name = "bda-unpaid"),
|
||||
|
||||
url(r'^bda/spectacles/unpaid/(?P<tirage_id>\d+)$', "bda.views.unpaid", name = "bda-unpaid"),
|
||||
url(r'^survey/(?P<survey_id>\d+)$', 'gestioncof.views.survey'),
|
||||
url(r'^event/(?P<event_id>\d+)$', 'gestioncof.views.event'),
|
||||
url(r'^survey/(?P<survey_id>\d+)/status$', 'gestioncof.views.survey_status'),
|
||||
|
|
|
@ -10,11 +10,14 @@
|
|||
<li><a href="{% url 'gestioncof.views.liste_bdadiff' %}">BdA diffusion</a></li>
|
||||
<li><a href="{% url 'gestioncof.views.liste_bdarevente' %}">BdA revente</a></li>
|
||||
</ul>
|
||||
<h3>Premier tirage</h3>
|
||||
<h3>Tirages</h3>
|
||||
{% for tirage in tirages %}
|
||||
<h4>{{ tirage.title }}</h4>
|
||||
<ul>
|
||||
<li><a href="{% url 'bda.views.etat_places' 1 %}">Etat des voeux</a></li>
|
||||
<li><a href="{% url 'bda-liste-spectacles' 1 %}">Mailing list par spectacle</a></li>
|
||||
<li><a href="{% url 'bda.views.unpaid' 1 %}">Mailing list des impayés</a></li>
|
||||
<li><a href="{% url 'bda-liste-spectacles-ics' 1 %}">Calendrier des spectacles (.ics)</a></li>
|
||||
<li><a href="{% url 'bda.views.etat_places' tirage.id %}">Etat des voeux</a></li>
|
||||
<li><a href="{% url 'bda-liste-spectacles' tirage.id %}">Mailing list par spectacle</a></li>
|
||||
<li><a href="{% url 'bda.views.unpaid' tirage.id %}">Mailing list des impayés</a></li>
|
||||
<li><a href="{% url 'bda-liste-spectacles-ics' tirage.id %}">Calendrier des spectacles (.ics)</a></li>
|
||||
</ul>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -504,7 +504,8 @@ def utile_cof(request):
|
|||
|
||||
@buro_required
|
||||
def utile_bda(request):
|
||||
return render(request, "utile_bda.html", {})
|
||||
tirages = Tirage.objects.all()
|
||||
return render(request, "utile_bda.html", {'tirages': tirages})
|
||||
|
||||
@buro_required
|
||||
def liste_bdadiff(request):
|
||||
|
|
Loading…
Reference in a new issue