From bfa5715f6deaa71ad51811bd2f59cdd330b860d9 Mon Sep 17 00:00:00 2001
From: Alban Gruin
Date: Fri, 3 Feb 2017 10:13:25 +0100
Subject: Ajout d'un lien pour voir l'emploi du temps de la semaine actuelle
---
templates/index.html | 4 ++--
urls.py | 1 +
views.py | 5 ++++-
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/templates/index.html b/templates/index.html
index 812a991..a89ab68 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -24,7 +24,7 @@ a:hover, a:focus {
text-decoration: underline;
}
-h1 a, h3 a {
+h1 a, h3 a, a.text {
color: #31363b;
}
@@ -61,7 +61,7 @@ li.course {
{% endfor %}{% endblock %}
diff --git a/urls.py b/urls.py
index 72c3dff..6bb488a 100644
--- a/urls.py
+++ b/urls.py
@@ -4,6 +4,7 @@ from . import views
urlpatterns = [
url(r"^$", views.index, name="index"),
+ url(r"^(?P[-\w]+)/$", views.timetable, name="timetable"),
url(r"^(?P[-\w]+)/(?P[0-9]{4})/(?P[0-4]?[0-9]|5[0-3])/$", views.timetable, name="timetable"),
url(r"^(?P[-\w]+)/(?P[0-9]{4})/(?P[0-4]?[0-9]|5[0-3])/subscribe$", views.subscribe, name="subscribe"),
url(r"^subscriptions/confirm/(?P[0-9a-f]{40})$", views.confirm_subscription, name="confirm"),
diff --git a/views.py b/views.py
index 25cf7f6..46c6ca7 100644
--- a/views.py
+++ b/views.py
@@ -34,7 +34,10 @@ def index(request):
return render(request, "index.html", {"timetables": timetables, "groups": groups})
-def timetable(request, group_slug, year, week):
+def timetable(request, group_slug, year=None, week=None):
+ if year is None or week is None:
+ year, week, _ = timezone.now().isocalendar()
+
start, end = get_week(int(year), int(week))
group = get_object_or_404(Group, slug=group_slug)
--
cgit v1.2.1