diff options
-rw-r--r-- | templates/index.html | 4 | ||||
-rw-r--r-- | urls.py | 1 | ||||
-rw-r--r-- | 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 { <section id="{{ timetable.slug }}"> <h3><a href="{{ timetable.url }}">{{ timetable.name }}</a></h3> <ul>{% for group in groups %}{% if group.timetable.id == timetable.id %} - <li>{{ group.name }} – {% for week in group.weeks %}<a href="{% url "timetable" group.slug week.year week|dt_week %}">{{ week|dt_prettyprint }}</a> {% endfor %}</li>{% endif %}{% endfor %} + <li><a class="text" href="{% url "timetable" group.slug %}">{{ group.name }}</a> – {% for week in group.weeks %}<a href="{% url "timetable" group.slug week.year week|dt_week %}">{{ week|dt_prettyprint }}</a> {% endfor %}</li>{% endif %}{% endfor %} </ul> </section>{% endfor %}{% endblock %} </div> @@ -4,6 +4,7 @@ from . import views urlpatterns = [ url(r"^$", views.index, name="index"), + url(r"^(?P<group_slug>[-\w]+)/$", views.timetable, name="timetable"), url(r"^(?P<group_slug>[-\w]+)/(?P<year>[0-9]{4})/(?P<week>[0-4]?[0-9]|5[0-3])/$", views.timetable, name="timetable"), url(r"^(?P<group_slug>[-\w]+)/(?P<year>[0-9]{4})/(?P<week>[0-4]?[0-9]|5[0-3])/subscribe$", views.subscribe, name="subscribe"), url(r"^subscriptions/confirm/(?P<token>[0-9a-f]{40})$", views.confirm_subscription, name="confirm"), @@ -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) |