Merge branch 'Aufinal/can_resell_paid' into 'master'

On peut revendre une place dès qu'on l'a payée

Closes #277

See merge request klub-dev-ens/gestioCOF!473
This commit is contained in:
Martin Pepin 2020-12-04 18:01:22 +01:00
commit 479e751b7c
4 changed files with 5 additions and 15 deletions

View file

@ -23,8 +23,10 @@ adhérents ni des cotisations.
## Version ??? - dans un futur proche
### COF
### COF / BdA
- On peut revendre une place dès qu'on l'a payée, plus besoin de payer toutes
ses places pour pouvoir revendre.
- On s'assure que les emails dans les demandes de petits cours sont valides.
### K-Fêt

View file

@ -3,7 +3,7 @@ from django.forms.models import BaseInlineFormSet
from django.template import loader
from django.utils import timezone
from bda.models import Attribution, Spectacle, SpectacleRevente
from bda.models import SpectacleRevente
class InscriptionInlineFormSet(BaseInlineFormSet):
@ -77,7 +77,7 @@ class ResellForm(forms.Form):
super().__init__(*args, **kwargs)
self.fields["attributions"] = TemplateLabelField(
queryset=participant.attribution_set.filter(
spectacle__date__gte=timezone.now()
spectacle__date__gte=timezone.now(), paid=True
)
.exclude(revente__seller=participant)
.select_related("spectacle", "spectacle__location", "participant__user"),

View file

@ -1,6 +0,0 @@
{% extends "base_title.html" %}
{% block realcontent %}
<h2><strong>Nope</strong></h2>
<p>Avant de revendre des places, il faut aller les payer !</p>
{% endblock %}

View file

@ -385,12 +385,6 @@ def revente_manage(request, tirage_id):
user=request.user, tirage=tirage
)
# If the participant has just been created, the `paid` field is not
# automatically added by our custom ObjectManager. Skip the check in this
# scenario.
if not created and not participant.paid:
return render(request, "bda/revente/notpaid.html", {})
resellform = ResellForm(participant, prefix="resell")
annulform = AnnulForm(participant, prefix="annul")
soldform = SoldForm(participant, prefix="sold")