aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlban Gruin2017-11-18 18:21:52 +0100
committerAlban Gruin2017-11-27 12:11:31 +0100
commitbb049a8d5954bbcf3ae5207a0ab4445591555d6e (patch)
tree3bc1b656098c61700cf256110d939610617e03be
parent3148aaf7c43866bd672d54ac54a0e70bc71f1020 (diff)
Tentative de mise en commun de la template des edts
-rw-r--r--templates/timetable.html12
-rw-r--r--views.py3
2 files changed, 8 insertions, 7 deletions
diff --git a/templates/timetable.html b/templates/timetable.html
index fc2065f..4c921fd 100644
--- a/templates/timetable.html
+++ b/templates/timetable.html
@@ -1,21 +1,21 @@
{% extends "index.html" %}
-{% block head %}
+{% block head %}{% if group_mode %}
<meta name="description" content="Emploi du temps du groupe {{ group }} &ndash; Semaine {{ week }}" />
<link rel="alternate" type="application/atom+xml" title="Emploi du temps du groupe {{ group }} (Atom)" href="{% url "atom" group.timetable.year.slug group.timetable.slug group.slug %}" />
<link rel="alternate" type="application/rss+xml" title="Emploi du temps du groupe {{ group }} (RSS)" href="{% url "rss" group.timetable.year.slug group.timetable.slug group.slug %}" />
<link rel="alternate" type="text/calendar" title="Emploi du temps du groupe {{ group }} (iCalendar)" href="{% url "ics" group.timetable.year.slug group.timetable.slug group.slug %}">
-{% endblock %}
+{% endif %}{% endblock %}
-{% block title %}{{ group.timetable }} &ndash; {{ group }} &ndash; Semaine {{ week }} &ndash; {% endblock %}
+{% block title %}{% if group_mode %}{{ group.timetable }} &ndash;{% else %}Salle{% endif %} {{ group }} &ndash; Semaine {{ week }} &ndash; {% endblock %}
{% block body %}
- <h2>{{ group.timetable }} &ndash; {{ group }} &ndash; Semaine {{ week }}</h2>
+ <h2>{% if group_mode %}{{ group.timetable }} &ndash;{% else %}Salle{% endif %} {{ group }} &ndash; Semaine {{ week }}</h2>
<p>
{% if is_old_timetable %}
- <b><a href="{% url "timetable" group.timetable.year.slug group.timetable.slug group.slug %}">Accéder à l’emploi du temps de cette semaine.</b></a><br />
+ <b><a href="{% if group_mode %}{% url "timetable" group.timetable.year.slug group.timetable.slug group.slug %}{% else %}{% url "room-timetable" group.slug %}{% endif %}">Accéder à l’emploi du temps de cette semaine.</b></a><br />
{% endif %}
{% if last_update %}Dernière mise à jour le {{ last_update|date:"l j F o" }} à {{ last_update|date:"H:i" }}{% endif %}
</p>
{% include "timetable_common.html" %}
- <p class="subscribe"><a href="{% url "calendars" group.timetable.year.slug group.timetable.slug group.slug %}">ICS</a> &ndash; <a href="{% url "rss" group.timetable.year.slug group.timetable.slug group.slug %}">RSS</a> &ndash; <a href="{% url "atom" group.timetable.year.slug group.timetable.slug group.slug %}">Atom</a></p>{% endblock %}
+ {% if group_mode %}<p class="subscribe"><a href="{% url "calendars" group.timetable.year.slug group.timetable.slug group.slug %}">ICS</a> &ndash; <a href="{% url "rss" group.timetable.year.slug group.timetable.slug group.slug %}">RSS</a> &ndash; <a href="{% url "atom" group.timetable.year.slug group.timetable.slug group.slug %}">Atom</a></p>{% endif %}{% endblock %}
diff --git a/views.py b/views.py
index 428711f..cb6978b 100644
--- a/views.py
+++ b/views.py
@@ -83,7 +83,8 @@ def timetable_common(request, obj, year=None, week=None):
return render(request, "timetable.html", {"group": obj, "courses": grouped_courses,
"last_update": last_update,
"year": year, "week": int(week),
- "is_old_timetable": is_old_timetable})
+ "is_old_timetable": is_old_timetable,
+ "group_mode": isinstance(obj, Group)})
def timetable(request, year_slug, timetable_slug, group_slug, year=None, week=None):
timetable = get_object_or_404(Timetable, year__slug=year_slug, slug=timetable_slug)