annulations reventes

This commit is contained in:
Ludovic Stephan 2016-07-24 00:48:05 +02:00
parent 2aaf9f681e
commit 8f7b036fbc
3 changed files with 18 additions and 9 deletions

View file

@ -6,7 +6,6 @@ from __future__ import unicode_literals
from django.shortcuts import render, get_object_or_404
from django.contrib.auth.decorators import login_required
from django.contrib import messages
from django.db import models
from django.db.models import Count
from django.core import serializers
@ -307,14 +306,15 @@ def revente(request, tirage_id):
attribution = Attribution.objects.get(id=int(attr_id))
revente = SpectacleRevente(attribution=attribution)
revente.save()
for attr_id in request.POST.getlist('annul'):
revente = SpectacleRevente.objects.get(attribution__pk=attr_id)
if 'annul' in request.POST:
revente = SpectacleRevente.objects\
.get(attribution__pk=request.POST['annul'])
revente.delete()
attributions = participant.attribution_set.filter(
spectacle__date__gte=timezone.now)
resell = attributions.filter(spectaclerevente__isnull=False)
no_resell = attributions.filter(spectaclerevente__isnull=True)
resell = attributions.filter(revente__isnull=False)
no_resell = attributions.filter(revente__isnull=True)
return render(request, "bda-revente.html",
{"participant": participant, 'tirage': tirage,
"resell": resell, "no_resell": no_resell})