def get_page_url(parser, token):
"""
Determines the URL of a pagination page link based on the page from which
this tag is called.
"""
args = token.split_contents()
argc = len(args)
varname = None
try:
assert argc in (2, 4)
except AssertionError:
raise template.TemplateSyntaxError('get_page_url syntax: {% get_page_url page_num as varname %}')
if argc == 4: varname = args[3]
return GetPageURLNode(args[1], varname)
评论列表
文章目录