SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit c2cac0fb authored by George Katsikas's avatar George Katsikas :goat:
Browse files

add absolute reverse utility function

parent 241b5d5b
No related branches found
No related tags found
No related merge requests found
__copyright__ = "Copyright © Stichting SciPost (SciPost Foundation)"
__license__ = "AGPL v3"
from django.contrib.auth.models import AnonymousUser
from django.contrib.sites.shortcuts import get_current_site
from common.utils.models import get_current_domain
def absolute_reverse(view_name, args=None, kwargs=None):
"""Return the absolute URL of a view, given its name and arguments."""
from django.urls import reverse
PROTOCOL = "https"
domain = get_current_domain()
reversed = reverse(view_name, args=args, kwargs=kwargs)
return f"{PROTOCOL}://{domain}{reversed}"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment