forked from DGNum/gestioCOF
Gestion des citations
This commit is contained in:
parent
f64a865de1
commit
68334e15d7
1 changed files with 4 additions and 2 deletions
|
@ -25,7 +25,7 @@ from django.views.generic.list import ListView
|
||||||
|
|
||||||
from gestioncof.decorators import cof_required, buro_required
|
from gestioncof.decorators import cof_required, buro_required
|
||||||
from bda.models import Spectacle, Participant, ChoixSpectacle, Attribution,\
|
from bda.models import Spectacle, Participant, ChoixSpectacle, Attribution,\
|
||||||
Tirage, SpectacleRevente, Salle
|
Tirage, SpectacleRevente, Salle, Quote
|
||||||
from bda.algorithm import Algorithm
|
from bda.algorithm import Algorithm
|
||||||
from bda.forms import BaseBdaFormSet, TokenForm, ResellForm, AnnulForm,\
|
from bda.forms import BaseBdaFormSet, TokenForm, ResellForm, AnnulForm,\
|
||||||
InscriptionReventeForm, SoldForm
|
InscriptionReventeForm, SoldForm
|
||||||
|
@ -691,7 +691,9 @@ def catalogue(request,request_type):
|
||||||
except:
|
except:
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
specquotes = lambda spectacle: [{'author': str(quote.author), 'text': str(quote.text)} for quote in Quote.objects.filter(spectacle = spectacle).all()]
|
||||||
|
|
||||||
# On convertit les descriptions à envoyer en une liste facilement JSONifiable (il devrait y avoir un moyen plus efficace en redéfinissant le serializer de JSON)
|
# On convertit les descriptions à envoyer en une liste facilement JSONifiable (il devrait y avoir un moyen plus efficace en redéfinissant le serializer de JSON)
|
||||||
data_return = [{'title': spectacle.title, 'category': str(spectacle.category), 'date': str(spectacle.date), 'location': str(spectacle.location), 'vips': spectacle.vips, 'description': spectacle.description, 'slots_description': spectacle.slots_description, 'image': getImgUrl(spectacle), 'ext_link': spectacle.ext_link, 'price': spectacle.price, 'slots': spectacle.slots} for spectacle in shows_qs.all()]
|
data_return = [{'title': spectacle.title, 'category': str(spectacle.category), 'date': str(spectacle.date), 'location': str(spectacle.location), 'vips': spectacle.vips, 'description': spectacle.description, 'slots_description': spectacle.slots_description, 'quotes': specquotes(spectacle),'image': getImgUrl(spectacle), 'ext_link': spectacle.ext_link, 'price': spectacle.price, 'slots': spectacle.slots} for spectacle in shows_qs.all()]
|
||||||
return HttpResponse(json.dumps(data_return))
|
return HttpResponse(json.dumps(data_return))
|
||||||
return HttpResponseBadRequest() # Si la requête n'est pas de la forme attendue, on quitte avec une erreur
|
return HttpResponseBadRequest() # Si la requête n'est pas de la forme attendue, on quitte avec une erreur
|
||||||
|
|
Loading…
Reference in a new issue