diff options
author | Alban Gruin | 2017-11-18 16:04:18 +0100 |
---|---|---|
committer | Alban Gruin | 2017-11-27 12:11:30 +0100 |
commit | 599ca85167ad7d53f6434b105cb74c761d994ecf (patch) | |
tree | f93cb1001a954f85e10e386349d66e4ed7afcac2 | |
parent | ac9489cf4faa063c9270a3900a52809306355ea2 (diff) |
Liens et URLs pour les emplois du temps des salles
-rw-r--r-- | templates/group_list.html | 2 | ||||
-rw-r--r-- | urls.py | 3 | ||||
-rw-r--r-- | views.py | 2 |
3 files changed, 4 insertions, 3 deletions
diff --git a/templates/group_list.html b/templates/group_list.html index 88cc7a4..7fe1fe8 100644 --- a/templates/group_list.html +++ b/templates/group_list.html @@ -7,7 +7,7 @@ <h3>{% if timetable %}<a href="{{ timetable.url }}">{{ timetable }}</a>{% else %}Emploi du temps des salles{% endif %}</h3> <ul> {% for group in groups %} - <li><a class="text"{% if group.weeks is not None %} href="{% if timetable %}{% url "timetable" timetable.year.slug timetable.slug group.slug %}{% else %}#{% endif %}"{% endif %}>{{ group }}</a> — {% for week in group.weeks %}<a href="{% if timetable %}{% url "timetable" timetable.year.slug timetable.slug group.slug week.year week|dt_week %}{% else %}#{% endif %}">{{ week|dt_prettyprint }}</a> {% if not forloop.last %}– {% endif %}{% empty %}<em>aucun cours dans le mois à venir</em>{% endfor %}</li> + <li><a class="text"{% if group.weeks is not None %} href="{% if timetable %}{% url "timetable" timetable.year.slug timetable.slug group.slug %}{% else %}{% url "room-timetable" group.slug %}{% endif %}"{% endif %}>{{ group }}</a> — {% for week in group.weeks %}<a href="{% if timetable %}{% url "timetable" timetable.year.slug timetable.slug group.slug week.year week|dt_week %}{% else %}{% url "room-timetable" group.slug week.year week|dt_week %}{% endif %}">{{ week|dt_prettyprint }}</a> {% if not forloop.last %}– {% endif %}{% empty %}<em>aucun cours dans le mois à venir</em>{% endfor %}</li> {% endfor %} </ul> {% endblock %} @@ -20,7 +20,8 @@ urlpatterns = [ url(r"^$", views.index, name="index"), url(r"^pages/", include("django.contrib.flatpages.urls")), url(r"^salles/$", views.rooms, name="rooms"), - url(r"^salles/(?P<room_slug>[-\w]+)$", views.room_timetable), + url(r"^salles/(?P<room_slug>[-\w]+)$", views.room_timetable, name="room-timetable"), + url(r"^salles/(?P<room_slug>[-\w]+)/(?P<year>[0-9]{4})/(?P<week>[0-4]?[0-9]|5[0-3])/$", views.room_timetable, name="room-timetable"), url(r"^(?P<year_slug>[-\w]+)/$", views.mention_list, name="mentions"), url(r"^(?P<year_slug>[-\w]+)/(?P<timetable_slug>[-\w]+)/$", views.group_list, name="groups"), url(r"^(?P<year_slug>[-\w]+)/(?P<timetable_slug>[-\w]+)/(?P<group_slug>[-\w]+)/$", views.timetable, name="timetable"), @@ -121,7 +121,7 @@ def rooms(request): return render(request, "group_list.html", {"groups": rooms_weeks}) -def room_timetable(request, room_slug): +def room_timetable(request, room_slug, year=None, week=None): room = get_object_or_404(Room, slug=room_slug) courses = Course.objects.filter(rooms__in=(room,)).order_by("begin") |