Fixed the is_in_section filter to return False when the resolver does not match at all in the Mia core application.

This commit is contained in:
依瑪貓 2020-08-11 23:09:02 +08:00
parent 990a5686d9
commit 3a32e00121

View File

@ -206,6 +206,8 @@ def is_in_section(request, section_name):
bool: True if the request is currently in this section, or False
otherwise
"""
if request.resolver_match is None:
return False
view_name = request.resolver_match.view_name
return view_name == section_name\
or view_name.startswith(section_name + ".")