Compare commits
1 commit
master
...
thubrecht/
Author | SHA1 | Date | |
---|---|---|---|
bd970561eb |
6 changed files with 45 additions and 2 deletions
|
@ -22,7 +22,7 @@ class Command(BaseCommand):
|
||||||
delay = timedelta(days=4)
|
delay = timedelta(days=4)
|
||||||
shows = (
|
shows = (
|
||||||
Spectacle.objects.filter(date__range=(now, now + delay))
|
Spectacle.objects.filter(date__range=(now, now + delay))
|
||||||
.filter(tirage__active=True)
|
.filter(tirage__active=True, tirage__send_rappels_auto=True)
|
||||||
.filter(rappel_sent__isnull=True)
|
.filter(rappel_sent__isnull=True)
|
||||||
.all()
|
.all()
|
||||||
)
|
)
|
||||||
|
|
20
bda/migrations/0019_tirage_send_rappels_auto.py
Normal file
20
bda/migrations/0019_tirage_send_rappels_auto.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
# Generated by Django 2.2.17 on 2021-01-08 15:51
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("bda", "0018_auto_20201021_1818"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="tirage",
|
||||||
|
name="send_rappels_auto",
|
||||||
|
field=models.BooleanField(
|
||||||
|
default=True, verbose_name="Envoi automatique des mails de rappel"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
|
@ -32,6 +32,9 @@ class Tirage(models.Model):
|
||||||
)
|
)
|
||||||
enable_do_tirage = models.BooleanField("Le tirage peut être lancé", default=False)
|
enable_do_tirage = models.BooleanField("Le tirage peut être lancé", default=False)
|
||||||
archived = models.BooleanField("Archivé", default=False)
|
archived = models.BooleanField("Archivé", default=False)
|
||||||
|
send_rappels_auto = models.BooleanField(
|
||||||
|
"Envoi automatique des mails de rappel", default=True
|
||||||
|
)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "%s - %s" % (
|
return "%s - %s" % (
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
|
from django.urls import path
|
||||||
|
|
||||||
from bda import views
|
from bda import views
|
||||||
from bda.views import SpectacleListView
|
from bda.views import SpectacleListView
|
||||||
|
@ -71,4 +72,9 @@ urlpatterns = [
|
||||||
),
|
),
|
||||||
url(r"^mails-rappel/(?P<spectacle_id>\d+)$", views.send_rappel, name="bda-rappels"),
|
url(r"^mails-rappel/(?P<spectacle_id>\d+)$", views.send_rappel, name="bda-rappels"),
|
||||||
url(r"^catalogue/(?P<request_type>[a-z]+)$", views.catalogue, name="bda-catalogue"),
|
url(r"^catalogue/(?P<request_type>[a-z]+)$", views.catalogue, name="bda-catalogue"),
|
||||||
|
path(
|
||||||
|
"toggle-rappels/<int:tirage_id>",
|
||||||
|
views.toggle_rappels,
|
||||||
|
name="bda-toggle-rappels",
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
12
bda/views.py
12
bda/views.py
|
@ -734,6 +734,18 @@ class SpectacleListView(ListView):
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
|
def toggle_rappels(request, tirage_id):
|
||||||
|
"""
|
||||||
|
Permet de désactiver ou de réactiver les envois de mails automatiques pour
|
||||||
|
les spectacles appartenant à ce tirage.
|
||||||
|
"""
|
||||||
|
tirage = get_object_or_404(Tirage, id=tirage_id)
|
||||||
|
tirage.send_rappels_auto = not tirage.send_rappels_auto
|
||||||
|
tirage.save()
|
||||||
|
|
||||||
|
return HttpResponseRedirect(reverse("home"))
|
||||||
|
|
||||||
|
|
||||||
class UnpaidParticipants(BuroRequiredMixin, ListView):
|
class UnpaidParticipants(BuroRequiredMixin, ListView):
|
||||||
context_object_name = "unpaid"
|
context_object_name = "unpaid"
|
||||||
template_name = "bda-unpaid.html"
|
template_name = "bda-unpaid.html"
|
||||||
|
|
|
@ -97,12 +97,14 @@
|
||||||
{% if active_tirages %}
|
{% if active_tirages %}
|
||||||
{% for tirage in active_tirages %}
|
{% for tirage in active_tirages %}
|
||||||
<ul>
|
<ul>
|
||||||
<h4>{{ tirage.title }}</h4>
|
<h4>{{ tirage.title }}</h4>
|
||||||
|
{% if not tirage.send_rappels_auto %}<h6><b>Les mails automatiques de rappels sont désactivés</b></h6>{% endif %}
|
||||||
<li><a href="{% url "bda-liste-spectacles" tirage.id %}">Spectacles</a></li>
|
<li><a href="{% url "bda-liste-spectacles" tirage.id %}">Spectacles</a></li>
|
||||||
<li><a href="{% url "admin:bda_participant_changelist" %}?tirage__id__exact={{ tirage.id }}">Participants</a></li>
|
<li><a href="{% url "admin:bda_participant_changelist" %}?tirage__id__exact={{ tirage.id }}">Participants</a></li>
|
||||||
{% if tirage.fermeture < now %}
|
{% if tirage.fermeture < now %}
|
||||||
<li><a href="{% url "bda-etat-places" tirage.id %}">Ratios</a></li>
|
<li><a href="{% url "bda-etat-places" tirage.id %}">Ratios</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<li><a href="{% url "bda-toggle-rappels" tirage.id %}">{% if tirage.send_rappels_auto %}Désactiver{% else %}Activer{% endif %} les mails de rappel automatiques</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
Loading…
Reference in a new issue