forked from DGNum/gestioCOF
Merge branch 'Kerl/del_old_view' into 'master'
Supprime la vue bda.views.descriptions_spectacles Closes #154 See merge request klub-dev-ens/gestioCOF!347
This commit is contained in:
commit
86dbdbd2b6
6 changed files with 4 additions and 197 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
- Abandon de l'ancien catalogue BdA (déjà plus utilisé depuis longtemps)
|
||||||
- Force l'unicité des logins clipper
|
- Force l'unicité des logins clipper
|
||||||
- Nouveau site du COF en wagtail
|
- Nouveau site du COF en wagtail
|
||||||
- Meilleurs affichage des longues listes de spectacles à cocher dans BdA-Revente
|
- Meilleurs affichage des longues listes de spectacles à cocher dans BdA-Revente
|
||||||
|
|
|
@ -1,113 +0,0 @@
|
||||||
{% load staticfiles %}
|
|
||||||
|
|
||||||
<!doctype html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<base target="_parent"/>
|
|
||||||
<style>
|
|
||||||
@font-face {
|
|
||||||
font-family: josefinsans;
|
|
||||||
src: url({% static "fonts/josefinsans.ttf" %});
|
|
||||||
}
|
|
||||||
|
|
||||||
*::-moz-selection {
|
|
||||||
background: #B0B0B0;
|
|
||||||
}
|
|
||||||
|
|
||||||
*::selection {
|
|
||||||
background: #B0B0B0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.descTable{
|
|
||||||
width: 100%;
|
|
||||||
margin: 0 auto 1em;
|
|
||||||
border-bottom: 2px solid;
|
|
||||||
border-collapse: collapse;
|
|
||||||
border-spacing: 0;
|
|
||||||
font-size: 14px;
|
|
||||||
line-height: 2;
|
|
||||||
max-width: 100%;
|
|
||||||
background-color: transparent;
|
|
||||||
font-family: 'josefinsans', 'Arial';
|
|
||||||
font-weight: 700;
|
|
||||||
color: #5a5a5a;
|
|
||||||
}
|
|
||||||
|
|
||||||
img{
|
|
||||||
max-width: 100%;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<meta charset="utf8" />
|
|
||||||
</head>
|
|
||||||
<script src="https://code.jquery.com/jquery-3.1.0.min.js"></script>
|
|
||||||
<body>
|
|
||||||
{% for show in shows %}
|
|
||||||
<table class="descTable">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th colspan="2"><p style="text-align:center;font-size:22px;">{{ show.title }}</p></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td><p style="text-align: left;">{{ show.location }}</p></td><td class="column-2"><p style="text-align: right;">{{ show.category }}</p></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><p style="text-align: left;">{{ show.date|date:"l j F Y - H\hi" }}</p></td><td class="column-2"><p style="text-align: right;">{{ show.slots }} place{{ show.slots|pluralize}} {% if show.slots_description != "" %}({{ show.slots_description }}){% endif %} - {{ show.price }} euro{{ show.price|pluralize}}</p></td>
|
|
||||||
</tr>
|
|
||||||
{% if show.vips %}
|
|
||||||
<tr>
|
|
||||||
<td colspan="2"><p style="text-align: justify;">{{ show.vips }}</p></td>
|
|
||||||
</tr>
|
|
||||||
{% endif %}
|
|
||||||
<tr>
|
|
||||||
<td colspan="2">
|
|
||||||
<p style="text-align: justify;">{{ show.description }}</p>
|
|
||||||
{% for quote in show.quote_set.all %}
|
|
||||||
<p style="text-align:center; font-style: italic;">«{{ quote.text }}»{% if quote.author %} - {{ quote.author }}{% endif %}</p>
|
|
||||||
{% endfor %}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% if show.image %}
|
|
||||||
<tr>
|
|
||||||
<td colspan="2"><p style="text-align:center;"><a href="{{ show.ext_link }}"><img class="imgDesc" style="display: inline;" src="{{ MEDIA_URL }}{{ show.image }}" alt="{{ show.title }}"></a></p></td>
|
|
||||||
</tr>
|
|
||||||
{% endif %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
{% endfor %}
|
|
||||||
<script>
|
|
||||||
// Correction de la taille des images
|
|
||||||
|
|
||||||
/*$(document).ready(function() {
|
|
||||||
$(".descTable").each(function() {
|
|
||||||
$(this).width($("body").width());
|
|
||||||
});
|
|
||||||
|
|
||||||
$(".imgDesc").on("load", function() {
|
|
||||||
|
|
||||||
// Dimensions
|
|
||||||
origHeight = 500; // Hauteur souhaitée
|
|
||||||
|
|
||||||
w = $(this).width();
|
|
||||||
h = $(this).height();
|
|
||||||
r = w/h; // Ratio de l'image
|
|
||||||
maxWidth = $("body").width();
|
|
||||||
|
|
||||||
if (r * origHeight > maxWidth)
|
|
||||||
{
|
|
||||||
$(this).width(maxWidth);
|
|
||||||
$(this).height(maxWidth/r);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$(this).width(r * origHeight);
|
|
||||||
$(this).height(origHeight);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});*/
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -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 %}
|
||||||
|
|
|
@ -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 = []
|
||||||
|
|
|
@ -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"),
|
||||||
]
|
]
|
||||||
|
|
20
bda/views.py
20
bda/views.py
|
@ -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 :
|
||||||
|
|
Loading…
Add table
Reference in a new issue