forked from DGNum/gestioCOF
Small code QoL improvements
This commit is contained in:
parent
e74dbb11f1
commit
919bcd197d
2 changed files with 12 additions and 8 deletions
|
@ -252,6 +252,16 @@ class SpectacleRevente(models.Model):
|
|||
class Meta:
|
||||
verbose_name = "Revente"
|
||||
|
||||
def reset(self):
|
||||
"""Réinitialise la revente pour permettre une remise sur le marché"""
|
||||
self.seller = self.attribution.participant
|
||||
self.date = timezone.now()
|
||||
self.answered_mail.clear()
|
||||
self.soldTo = None
|
||||
self.notif_sent = False
|
||||
self.tirage_done = False
|
||||
self.shotgun = False
|
||||
|
||||
def send_notif(self):
|
||||
"""
|
||||
Envoie une notification pour indiquer la mise en vente d'une place sur
|
||||
|
|
10
bda/views.py
10
bda/views.py
|
@ -375,13 +375,7 @@ def revente_manage(request, tirage_id):
|
|||
attribution=attribution,
|
||||
defaults={'seller': participant})
|
||||
if not created:
|
||||
revente.seller = participant
|
||||
revente.date = timezone.now()
|
||||
revente.wanted = Participant.objects.none()
|
||||
revente.soldTo = None
|
||||
revente.notif_sent = False
|
||||
revente.tirage_done = False
|
||||
revente.shotgun = False
|
||||
revente.reset()
|
||||
context = {
|
||||
'vendeur': participant.user,
|
||||
'show': attribution.spectacle,
|
||||
|
@ -495,7 +489,7 @@ def revente_confirm(request, revente_id):
|
|||
revente = get_object_or_404(SpectacleRevente, id=revente_id)
|
||||
participant, _ = Participant.objects.get_or_create(
|
||||
user=request.user, tirage=revente.attribution.spectacle.tirage)
|
||||
if (timezone.now() < revente.date + timedelta(hours=1)) or revente.shotgun:
|
||||
if not revente.notif_sent or revente.shotgun:
|
||||
return render(request, "bda/revente/wrongtime.html",
|
||||
{"revente": revente})
|
||||
|
||||
|
|
Loading…
Reference in a new issue