diff --git a/bda/templates/spectacle_list.html b/bda/templates/spectacle_list.html index d6714335..2ae412ce 100644 --- a/bda/templates/spectacle_list.html +++ b/bda/templates/spectacle_list.html @@ -17,11 +17,11 @@ Date Lieu Prix - + {% for spectacle in object_list %} - + {{ spectacle.title }} {{ spectacle.date }} {{ spectacle.location }} @@ -51,6 +51,5 @@

Exports

{% endblock %} diff --git a/bda/tests/test_views.py b/bda/tests/test_views.py index 1d4494cb..3dc1b4d1 100644 --- a/bda/tests/test_views.py +++ b/bda/tests/test_views.py @@ -4,9 +4,8 @@ from datetime import timedelta from django.test import TestCase from django.utils import formats, timezone -from ..models import CategorieSpectacle, Participant, Salle +from ..models import Participant from .testcases import BdATestHelpers, BdAViewTestCaseMixin -from .utils import create_spectacle class InscriptionViewTestCase(BdATestHelpers, BdAViewTestCaseMixin, TestCase): @@ -281,60 +280,6 @@ class SendRemindersViewTestCase(BdATestHelpers, BdAViewTestCaseMixin, TestCase): # 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): auth_user = None auth_forbidden = [] diff --git a/bda/urls.py b/bda/urls.py index 7ac21648..cefde4a2 100644 --- a/bda/urls.py +++ b/bda/urls.py @@ -66,10 +66,5 @@ urlpatterns = [ name="bda-revente-shotgun", ), url(r"^mails-rappel/(?P\d+)$", views.send_rappel, name="bda-rappels"), - url( - r"^descriptions/(?P\d+)$", - views.descriptions_spectacles, - name="bda-descriptions", - ), url(r"^catalogue/(?P[a-z]+)$", views.catalogue, name="bda-catalogue"), ] diff --git a/bda/views.py b/bda/views.py index 1b7ef11f..2b02e203 100644 --- a/bda/views.py +++ b/bda/views.py @@ -8,7 +8,6 @@ from custommail.models import CustomMail from custommail.shortcuts import send_custom_mail, send_mass_custom_mail from django.conf import settings from django.contrib import messages -from django.contrib.auth.decorators import login_required from django.core import serializers from django.core.exceptions import NON_FIELD_ERRORS from django.core.urlresolvers import reverse @@ -777,25 +776,6 @@ def send_rappel(request, spectacle_id): 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): """ Vue destinée à communiquer avec un client AJAX, fournissant soit :