Revised the url_period template tag so that it works with or without the subject code in the mia_core application.

This commit is contained in:
依瑪貓 2020-07-17 23:05:23 +08:00
parent f33a1631fa
commit 856bcd47ff

View File

@ -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