forked from DGNum/gestioCOF
Merge branch 'Aufinal/bda_revente' of git.eleves.ens.fr:cof-geek/gestioCOF into Aufinal/bda_revente
This commit is contained in:
commit
37b4a178a7
38 changed files with 649 additions and 126 deletions
|
@ -14,6 +14,7 @@ class Command(BaseCommand):
|
|||
|
||||
def handle(self, *args, **options):
|
||||
now = timezone.now()
|
||||
self.stdout.write(now)
|
||||
reventes = SpectacleRevente.objects.all()
|
||||
for revente in reventes:
|
||||
# Check si < 24h
|
||||
|
@ -22,11 +23,14 @@ class Command(BaseCommand):
|
|||
now >= revente.date + timedelta(minutes=15) and \
|
||||
not revente.notif_sent:
|
||||
revente.mail_shotgun()
|
||||
self.stdout.write("Mail de disponibilité immédiate envoyé")
|
||||
# Check si délai de retrait dépassé
|
||||
elif (now >= revente.date + timedelta(hours=1) and
|
||||
not revente.notif_sent):
|
||||
revente.send_notif()
|
||||
self.stdout.write("Mail d'inscription à une revente envoyé")
|
||||
# Check si tirage à faire
|
||||
elif (now >= revente.expiration_time and
|
||||
not revente.tirage_done):
|
||||
revente.tirage()
|
||||
self.stdout.write("Tirage effectué, mails envoyés")
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<base target="_parent"/>
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: josefinsans;
|
||||
|
@ -31,6 +32,10 @@
|
|||
font-weight: 700;
|
||||
color: #5a5a5a;
|
||||
}
|
||||
|
||||
img{
|
||||
max-width: 100%;
|
||||
}
|
||||
</style>
|
||||
<meta charset="utf8" />
|
||||
</head>
|
||||
|
@ -50,11 +55,16 @@
|
|||
<tr>
|
||||
<td><p style="text-align: left;">{{ show.date|date:"l j F Y - H\hi" }}</p></td><td class="column-2"><p style="text-align: right;">{{ show.slots }} place{{ show.slots|pluralize}} {% if show.slots_description != "" %}({{ show.slots_description }}){% endif %} - {{ show.price }} euro{{ show.price|pluralize}}</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
{% if show.vips %}
|
||||
<tr>
|
||||
<td colspan="2"><p style="text-align: justify;">{{ show.vips }}</p></td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<p style="text-align: justify;">{{ show.description }}</p>
|
||||
{% for quote in show.quote_set.all %}
|
||||
<p style="text-align:center; font-style: italic;">«{{ quote.text }}»{% if show.quote.author %} - {{ quote.author }}{% endif %}</p>
|
||||
<p style="text-align:center; font-style: italic;">«{{ quote.text }}»{% if quote.author %} - {{ quote.author }}{% endif %}</p>
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -69,7 +79,7 @@
|
|||
<script>
|
||||
// Correction de la taille des images
|
||||
|
||||
$(document).ready(function() {
|
||||
/*$(document).ready(function() {
|
||||
$(".descTable").each(function() {
|
||||
$(this).width($("body").width());
|
||||
});
|
||||
|
@ -95,7 +105,7 @@
|
|||
$(this).height(origHeight);
|
||||
}
|
||||
});
|
||||
});
|
||||
});*/
|
||||
|
||||
|
||||
</script>
|
||||
|
|
12
bda/views.py
12
bda/views.py
|
@ -71,7 +71,7 @@ def etat_places(request, tirage_id):
|
|||
|
||||
|
||||
def _hash_queryset(queryset):
|
||||
data = serializers.serialize("json", queryset).encode()
|
||||
data = serializers.serialize("json", queryset).encode('utf-8')
|
||||
hasher = hashlib.sha256()
|
||||
hasher.update(data)
|
||||
return hasher.hexdigest()
|
||||
|
@ -406,7 +406,7 @@ def list_revente(request, tirage_id):
|
|||
if qset.exists():
|
||||
# On l'inscrit à l'un des tirages au sort
|
||||
for revente in qset.all():
|
||||
if revente.shotgun:
|
||||
if revente.shotgun and not revente.soldTo:
|
||||
deja_revente = True
|
||||
else:
|
||||
revente.interested.add(participant)
|
||||
|
@ -435,12 +435,16 @@ def buy_revente(request, spectacle_id):
|
|||
revente.delete()
|
||||
return HttpResponseRedirect(reverse("bda-liste-revente",
|
||||
args=[tirage.id]))
|
||||
reventes_shotgun = []
|
||||
for revente in reventes.all():
|
||||
if revente.shotgun:
|
||||
reventes_shotgun.append(revente)
|
||||
|
||||
if not reventes.exists():
|
||||
if reventes_shotgun.empty():
|
||||
return render(request, "bda-no-revente.html", {})
|
||||
|
||||
if request.POST:
|
||||
revente = random.choice(reventes.all())
|
||||
revente = random.choice(reventes_shotgun)
|
||||
revente.soldTo = participant
|
||||
revente.save()
|
||||
mail = """Bonjour !
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue