From 856bcd47ffaab8802ba1132f1baa72adffd393c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Fri, 17 Jul 2020 23:05:23 +0800 Subject: [PATCH] Revised the url_period template tag so that it works with or without the subject code in the mia_core application. --- mia_core/templatetags/mia_core.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mia_core/templatetags/mia_core.py b/mia_core/templatetags/mia_core.py index 774378c..1953f4e 100644 --- a/mia_core/templatetags/mia_core.py +++ b/mia_core/templatetags/mia_core.py @@ -85,8 +85,9 @@ def url_period(context, period_spec): viewname = "%s:%s" % ( request.resolver_match.app_name, request.resolver_match.url_name) - subject_code = request.resolver_match.kwargs["subject_code"] - return reverse(viewname, args=[subject_code, period_spec]) + kwargs = request.resolver_match.kwargs + kwargs["period_spec"] = period_spec + return reverse(viewname, kwargs=kwargs) @register.filter