Add /whoami view for logged-in user

This commit is contained in:
Seamus Johnston 2022-09-13 09:15:40 -05:00 committed by Neil Martinsen-Burrell
parent cbf39aa3c3
commit f147f8c2ab
No known key found for this signature in database
GPG key ID: 6A3C818CC10D0184
16 changed files with 375 additions and 167 deletions

View file

@ -11,3 +11,12 @@ def language_code(request):
TEMPLATES dict of our settings file).
"""
return {"LANGUAGE_CODE": settings.LANGUAGE_CODE}
def canonical_path(request):
"""Add a canonical URL to the template context.
To make a correct "rel=canonical" link in the HTML page, we need to
construct an absolute URL for the page, and we can't do that in the
template itself, so we do it here and pass the information on.
"""
return {"CANONICAL_PATH": request.build_absolute_uri(request.path)}