From 456fb50a47919f58fb000336865f1d536aa7c04c Mon Sep 17 00:00:00 2001 From: champeno Date: Tue, 29 Sep 2015 22:56:30 +0200 Subject: [PATCH] =?UTF-8?q?G=C3=A8re=20le=20cas=20de=20l'absence=20de=20li?= =?UTF-8?q?eu=20de=20stage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- monstage/templates/monstage/stage.html | 4 +++- monstage/templates/monstage/stage_edit_lieu.html | 13 ++++++++++++- monstage/views.py | 3 ++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/monstage/templates/monstage/stage.html b/monstage/templates/monstage/stage.html index 18c5707..c1531b7 100644 --- a/monstage/templates/monstage/stage.html +++ b/monstage/templates/monstage/stage.html @@ -41,13 +41,15 @@ {% endif %}
+ {% if stage.lieux.all %}
+ {% endif %}
{% if modifiable %}

Modifier la description du stage (sujet, ...)

{% endif %}

{{ stage.profil_user.user.first_name }} {{ stage.profil_user.user.last_name }} a fait ce stage du {{ stage.start_date }} au {{ stage.end_date }}{% if stage.encadrants %}, supervisé par {{ stage.encadrants }}{% endif %}.

Matières : {% for matiere in stage.matieres.all %}{% if not forloop.first %}, {% endif %}{{ matiere.name }}{% endfor %}

Thématiques : {% for tag in stage.thematiques.names %}{% if not forloop.first %}, {% endif %}{{ tag }}{% endfor %}

-

À {% for lieu in stage.lieux.all %}{% if not forloop.first %}{% if forloop.last %} et {% else %}, {% endif %}{% endif %}{{ lieu.name }} ({{ lieu.ville }}){% endfor %}

+ {% if stage.lieux.all %}

À {% for lieu in stage.lieux.all %}{% if not forloop.first %}{% if forloop.last %} et {% else %}, {% endif %}{% endif %}{{ lieu.name }} ({{ lieu.ville }}){% endfor %}

{% endif %} {% if modifiable %}

Modifier les lieux du stage

{% endif %}
diff --git a/monstage/templates/monstage/stage_edit_lieu.html b/monstage/templates/monstage/stage_edit_lieu.html index 050293a..9f8ba0d 100644 --- a/monstage/templates/monstage/stage_edit_lieu.html +++ b/monstage/templates/monstage/stage_edit_lieu.html @@ -30,7 +30,7 @@
- + {% endblock %} diff --git a/monstage/views.py b/monstage/views.py index bdabb37..a2f45fb 100644 --- a/monstage/views.py +++ b/monstage/views.py @@ -10,6 +10,7 @@ from django.contrib.gis.geos import GEOSGeometry from django.contrib.gis import measure from django.forms.widgets import HiddenInput from django.core.mail import send_mail +from django.template.defaultfilters import slugify from monstage.models import * @@ -312,7 +313,7 @@ def search(request): if thematiques: q = Q() for thematique in thematiques: - q |= Q(thematiques__slug__icontains = thematique) + q |= Q(thematiques__slug__contains = slugify(thematique)) stages = stages.filter(q).distinct() stages = stages.all() else: