Gère le cas de l'absence de lieu de stage
This commit is contained in:
parent
a41f597827
commit
456fb50a47
3 changed files with 17 additions and 3 deletions
|
@ -41,13 +41,15 @@
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div id="stage_present">
|
<div id="stage_present">
|
||||||
|
{% if stage.lieux.all %}
|
||||||
<div id="stage_map"></div>
|
<div id="stage_map"></div>
|
||||||
|
{% endif %}
|
||||||
<div id="stage_misc">
|
<div id="stage_misc">
|
||||||
{% if modifiable %}<p><a href="{% url 'monstage:stage_edit_desc' stage.id %}" class="changestage">Modifier la description du stage (sujet, ...)</a></p>{% endif %}
|
{% if modifiable %}<p><a href="{% url 'monstage:stage_edit_desc' stage.id %}" class="changestage">Modifier la description du stage (sujet, ...)</a></p>{% endif %}
|
||||||
<p><a href="{% url 'monstage:profil' stage.profil_user.user.username %}">{{ stage.profil_user.user.first_name }} {{ stage.profil_user.user.last_name }}</a> a fait ce stage du {{ stage.start_date }} au {{ stage.end_date }}{% if stage.encadrants %}, supervisé par {{ stage.encadrants }}{% endif %}.</p>
|
<p><a href="{% url 'monstage:profil' stage.profil_user.user.username %}">{{ stage.profil_user.user.first_name }} {{ stage.profil_user.user.last_name }}</a> a fait ce stage du {{ stage.start_date }} au {{ stage.end_date }}{% if stage.encadrants %}, supervisé par {{ stage.encadrants }}{% endif %}.</p>
|
||||||
<p>Matières : {% for matiere in stage.matieres.all %}{% if not forloop.first %}, {% endif %}{{ matiere.name }}{% endfor %}</p>
|
<p>Matières : {% for matiere in stage.matieres.all %}{% if not forloop.first %}, {% endif %}{{ matiere.name }}{% endfor %}</p>
|
||||||
<p>Thématiques : {% for tag in stage.thematiques.names %}{% if not forloop.first %}, {% endif %}{{ tag }}{% endfor %}</p>
|
<p>Thématiques : {% for tag in stage.thematiques.names %}{% if not forloop.first %}, {% endif %}{{ tag }}{% endfor %}</p>
|
||||||
<p>À {% for lieu in stage.lieux.all %}{% if not forloop.first %}{% if forloop.last %} et {% else %}, {% endif %}{% endif %}{{ lieu.name }} ({{ lieu.ville }}){% endfor %}</p>
|
{% if stage.lieux.all %}<p>À {% for lieu in stage.lieux.all %}{% if not forloop.first %}{% if forloop.last %} et {% else %}, {% endif %}{% endif %}{{ lieu.name }} ({{ lieu.ville }}){% endfor %}</p>{% endif %}
|
||||||
{% if modifiable %}<p><a href="{% url 'monstage:stage_edit_lieu' stage.id %}" class="changestage">Modifier les lieux du stage</a></p>{% endif %}
|
{% if modifiable %}<p><a href="{% url 'monstage:stage_edit_lieu' stage.id %}" class="changestage">Modifier les lieux du stage</a></p>{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
<div id="map_addlieu"></div>
|
<div id="map_addlieu"></div>
|
||||||
<div id="candidats"></div>
|
<div id="candidats"></div>
|
||||||
|
|
||||||
<input type="submit" value="Enregistrer" />
|
<input type="submit" value="Enregistrer" onclick="return checkForm();"/>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -137,6 +137,17 @@
|
||||||
addKnownPlace(this.data);
|
addKnownPlace(this.data);
|
||||||
clearCandidats();
|
clearCandidats();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkForm () {
|
||||||
|
for(var i=0; i<fieldcount; i++){
|
||||||
|
if (!document.getElementById('id_'+i+'-delete').checked)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(confirm("Vous n'avez aucun lieu de précisé, vous ne pourrez pas donner d'avis complet sur votre stage !\nÊtes-vous sûr de vouloir continuer ?")) {
|
||||||
|
return true;
|
||||||
|
}else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ from django.contrib.gis.geos import GEOSGeometry
|
||||||
from django.contrib.gis import measure
|
from django.contrib.gis import measure
|
||||||
from django.forms.widgets import HiddenInput
|
from django.forms.widgets import HiddenInput
|
||||||
from django.core.mail import send_mail
|
from django.core.mail import send_mail
|
||||||
|
from django.template.defaultfilters import slugify
|
||||||
|
|
||||||
from monstage.models import *
|
from monstage.models import *
|
||||||
|
|
||||||
|
@ -312,7 +313,7 @@ def search(request):
|
||||||
if thematiques:
|
if thematiques:
|
||||||
q = Q()
|
q = Q()
|
||||||
for thematique in thematiques:
|
for thematique in thematiques:
|
||||||
q |= Q(thematiques__slug__icontains = thematique)
|
q |= Q(thematiques__slug__contains = slugify(thematique))
|
||||||
stages = stages.filter(q).distinct()
|
stages = stages.filter(q).distinct()
|
||||||
stages = stages.all()
|
stages = stages.all()
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue