forked from DGNum/gestioCOF
déplacement shotgun
This commit is contained in:
parent
5e848e4442
commit
d1456d7c68
5 changed files with 40 additions and 9 deletions
14
bda/templates/bda-shotgun.html
Normal file
14
bda/templates/bda-shotgun.html
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
{% extends "base_title.html" %}
|
||||||
|
|
||||||
|
{% block realcontent %}
|
||||||
|
<h2>Places disponibles immédiatement</h2>
|
||||||
|
{% if shotgun %}
|
||||||
|
<ul class="list-unstyled">
|
||||||
|
{% for spectacle in shotgun %}
|
||||||
|
<li><a href="{% url "bda-buy-revente" spectacle.id %}">{{spectacle}}</a></li>
|
||||||
|
{% endfor %}
|
||||||
|
{% else %}
|
||||||
|
<p> Pas de places disponibles immédiatement, désolé !</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% endblock %}
|
|
@ -28,15 +28,6 @@
|
||||||
<input type="submit" class="btn btn-primary" value="S'inscrire pour les places sélectionnées">
|
<input type="submit" class="btn btn-primary" value="S'inscrire pour les places sélectionnées">
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{% if shotgun %}
|
|
||||||
<br>
|
|
||||||
<h3>Places disponibles immédiatement</h3>
|
|
||||||
<ul class="list-unstyled">
|
|
||||||
{% for spectacle in shotgun %}
|
|
||||||
<li><a href="{% url "bda-buy-revente" spectacle.id %}">{{spectacle}}</a></li>
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<script language="JavaScript">
|
<script language="JavaScript">
|
||||||
function select(check) {
|
function select(check) {
|
||||||
checkboxes = document.getElementsByName("spectacles");
|
checkboxes = document.getElementsByName("spectacles");
|
||||||
|
|
|
@ -41,6 +41,9 @@ urlpatterns = [
|
||||||
url(r'^revente-interested/(?P<revente_id>\d+)$',
|
url(r'^revente-interested/(?P<revente_id>\d+)$',
|
||||||
"bda.views.revente_interested",
|
"bda.views.revente_interested",
|
||||||
name='bda-revente-interested'),
|
name='bda-revente-interested'),
|
||||||
|
url(r'^revente-immediat/(?P<tirage_id>\d+)$',
|
||||||
|
"bda.views.revente_shotgun",
|
||||||
|
name="bda-shotgun"),
|
||||||
url(r'^mails-rappel/(?P<spectacle_id>\d+)$', views.send_rappel),
|
url(r'^mails-rappel/(?P<spectacle_id>\d+)$', views.send_rappel),
|
||||||
url(r'^descriptions/(?P<tirage_id>\d+)$', views.descriptions_spectacles,
|
url(r'^descriptions/(?P<tirage_id>\d+)$', views.descriptions_spectacles,
|
||||||
name='bda-descriptions'),
|
name='bda-descriptions'),
|
||||||
|
|
22
bda/views.py
22
bda/views.py
|
@ -471,6 +471,28 @@ Contacte-moi si tu es toujours intéressé·e !
|
||||||
"user": request.user})
|
"user": request.user})
|
||||||
|
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def revente_shotgun(request, tirage_id):
|
||||||
|
tirage = get_object_or_404(Tirage, id=tirage_id)
|
||||||
|
spectacles = tirage.spectacle_set.filter(
|
||||||
|
date__gte=timezone.now())
|
||||||
|
shotgun = []
|
||||||
|
for spectacle in spectacles:
|
||||||
|
revente_objects = SpectacleRevente.objects.filter(
|
||||||
|
attribution__spectacle=spectacle,
|
||||||
|
soldTo__isnull=True)
|
||||||
|
revente_count = 0
|
||||||
|
for revente in revente_objects:
|
||||||
|
if revente.shotgun:
|
||||||
|
revente_count += 1
|
||||||
|
if revente_count:
|
||||||
|
spectacle.revente_count = revente_count
|
||||||
|
shotgun.append(spectacle)
|
||||||
|
|
||||||
|
return render(request, "revente-shotgun.html",
|
||||||
|
{"shotgun": shotgun})
|
||||||
|
|
||||||
|
|
||||||
@buro_required
|
@buro_required
|
||||||
def spectacle(request, tirage_id, spectacle_id):
|
def spectacle(request, tirage_id, spectacle_id):
|
||||||
tirage = get_object_or_404(Tirage, id=tirage_id)
|
tirage = get_object_or_404(Tirage, id=tirage_id)
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
<li><a href="{% url "bda-places-attribuees" tirage.id %}">Mes places</a></li>
|
<li><a href="{% url "bda-places-attribuees" tirage.id %}">Mes places</a></li>
|
||||||
<li><a href="{% url "bda-revente" tirage.id %}">Revendre une place</a></li>
|
<li><a href="{% url "bda-revente" tirage.id %}">Revendre une place</a></li>
|
||||||
<li><a href="{% url "bda-liste-revente" tirage.id %}">S'inscrire à BdA-Revente</a></li>
|
<li><a href="{% url "bda-liste-revente" tirage.id %}">S'inscrire à BdA-Revente</a></li>
|
||||||
|
<li><a href="{% url "bda-shotgun" tirage.id %}">Places disponibles immédiatement</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
Loading…
Reference in a new issue