remove bda.views.descriptions_spectacles

This view has been unused for a long time
It has been replace by bda.views.catalogue
This commit is contained in:
Martin Pépin 2019-02-04 20:58:53 +01:00
parent be155f2f2d
commit 869e634adb
4 changed files with 3 additions and 84 deletions

View file

@ -17,11 +17,11 @@
<th data-sort="int">Date</th> <th data-sort="int">Date</th>
<th data-sort="string">Lieu</th> <th data-sort="string">Lieu</th>
<th data-sort="float">Prix</th> <th data-sort="float">Prix</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for spectacle in object_list %} {% for spectacle in object_list %}
<tr class="clickable-row {% if spectacle.is_past %}spectacle-passe{% endif %}" data-href="{% url 'bda-spectacle' tirage_id spectacle.id %}"> <tr class="clickable-row {% if spectacle.is_past %}spectacle-passe{% endif %}" data-href="{% url 'bda-spectacle' tirage_id spectacle.id %}">
<td><a href="{% url 'bda-spectacle' tirage_id spectacle.id %}">{{ spectacle.title }} <span style="font-size:small;" class="glyphicon glyphicon-link" aria-hidden="true"></span></a></td> <td><a href="{% url 'bda-spectacle' tirage_id spectacle.id %}">{{ spectacle.title }} <span style="font-size:small;" class="glyphicon glyphicon-link" aria-hidden="true"></span></a></td>
<td data-sort-value="{{ spectacle.timestamp }}"">{{ spectacle.date }}</td> <td data-sort-value="{{ spectacle.timestamp }}"">{{ spectacle.date }}</td>
<td data-sort-value="{{ spectacle.location }}">{{ spectacle.location }}</td> <td data-sort-value="{{ spectacle.location }}">{{ spectacle.location }}</td>
@ -51,6 +51,5 @@
<h3> Exports </h3> <h3> Exports </h3>
<ul> <ul>
<li><a href="{% url 'bda-unpaid' tirage_id %}">Mailing list impayés</a> <li><a href="{% url 'bda-unpaid' tirage_id %}">Mailing list impayés</a>
<li><a href="{% url 'bda-descriptions' tirage_id %}">Lien vers les descriptions des spectacles, à utiliser dans une page wordpress</a>
</ul> </ul>
{% endblock %} {% endblock %}

View file

@ -4,9 +4,8 @@ from datetime import timedelta
from django.test import TestCase from django.test import TestCase
from django.utils import formats, timezone from django.utils import formats, timezone
from ..models import CategorieSpectacle, Participant, Salle from ..models import Participant
from .testcases import BdATestHelpers, BdAViewTestCaseMixin from .testcases import BdATestHelpers, BdAViewTestCaseMixin
from .utils import create_spectacle
class InscriptionViewTestCase(BdATestHelpers, BdAViewTestCaseMixin, TestCase): class InscriptionViewTestCase(BdATestHelpers, BdAViewTestCaseMixin, TestCase):
@ -281,60 +280,6 @@ class SendRemindersViewTestCase(BdATestHelpers, BdAViewTestCaseMixin, TestCase):
# TODO: check that emails are sent # TODO: check that emails are sent
class DescriptionsSpectaclesViewTestCase(
BdATestHelpers, BdAViewTestCaseMixin, TestCase
):
url_name = "bda-descriptions"
auth_user = None
auth_forbidden = []
bda_testdata = True
@property
def url_kwargs(self):
return {"tirage_id": self.tirage.pk}
@property
def url_expected(self):
return "/bda/descriptions/{}".format(self.tirage.pk)
def test_get(self):
resp = self.client.get(self.url)
self.assertEqual(resp.status_code, 200)
self.assertListEqual(
list(resp.context["shows"]), [self.show1, self.show2, self.show3]
)
def test_get_filter_category(self):
category1 = CategorieSpectacle.objects.create(name="Category 1")
category2 = CategorieSpectacle.objects.create(name="Category 2")
show1 = create_spectacle(category=category1, tirage=self.tirage)
show2 = create_spectacle(category=category2, tirage=self.tirage)
resp = self.client.get(self.url, {"category": "Category 1"})
self.assertEqual(resp.status_code, 200)
self.assertListEqual(list(resp.context["shows"]), [show1])
resp = self.client.get(self.url, {"category": "Category 2"})
self.assertEqual(resp.status_code, 200)
self.assertListEqual(list(resp.context["shows"]), [show2])
def test_get_filter_location(self):
location1 = Salle.objects.create(name="Location 1")
location2 = Salle.objects.create(name="Location 2")
show1 = create_spectacle(location=location1, tirage=self.tirage)
show2 = create_spectacle(location=location2, tirage=self.tirage)
resp = self.client.get(self.url, {"location": str(location1.pk)})
self.assertEqual(resp.status_code, 200)
self.assertListEqual(list(resp.context["shows"]), [show1])
resp = self.client.get(self.url, {"location": str(location2.pk)})
self.assertEqual(resp.status_code, 200)
self.assertListEqual(list(resp.context["shows"]), [show2])
class CatalogueViewTestCase(BdATestHelpers, BdAViewTestCaseMixin, TestCase): class CatalogueViewTestCase(BdATestHelpers, BdAViewTestCaseMixin, TestCase):
auth_user = None auth_user = None
auth_forbidden = [] auth_forbidden = []

View file

@ -66,10 +66,5 @@ urlpatterns = [
name="bda-revente-shotgun", name="bda-revente-shotgun",
), ),
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"^descriptions/(?P<tirage_id>\d+)$",
views.descriptions_spectacles,
name="bda-descriptions",
),
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"),
] ]

View file

@ -8,7 +8,6 @@ from custommail.models import CustomMail
from custommail.shortcuts import send_custom_mail, send_mass_custom_mail from custommail.shortcuts import send_custom_mail, send_mass_custom_mail
from django.conf import settings from django.conf import settings
from django.contrib import messages from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core import serializers from django.core import serializers
from django.core.exceptions import NON_FIELD_ERRORS from django.core.exceptions import NON_FIELD_ERRORS
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
@ -777,25 +776,6 @@ def send_rappel(request, spectacle_id):
return render(request, "bda/mails-rappel.html", ctxt) return render(request, "bda/mails-rappel.html", ctxt)
def descriptions_spectacles(request, tirage_id):
tirage = get_object_or_404(Tirage, id=tirage_id)
shows_qs = tirage.spectacle_set.select_related("location").prefetch_related(
"quote_set"
)
category_name = request.GET.get("category", "")
location_id = request.GET.get("location", "")
if category_name:
shows_qs = shows_qs.filter(category__name=category_name)
if location_id:
try:
shows_qs = shows_qs.filter(location__id=int(location_id))
except ValueError:
return HttpResponseBadRequest(
"La variable GET 'location' doit contenir un entier"
)
return render(request, "descriptions.html", {"shows": shows_qs})
def catalogue(request, request_type): def catalogue(request, request_type):
""" """
Vue destinée à communiquer avec un client AJAX, fournissant soit : Vue destinée à communiquer avec un client AJAX, fournissant soit :