From c031a3e9405fac558128f17ed413e862ce978a8c Mon Sep 17 00:00:00 2001 From: George Katsikas <giorgakis.katsikas@gmail.com> Date: Mon, 13 Nov 2023 14:52:22 +0100 Subject: [PATCH] add domain name to refereeing actions urls fixes #132 --- scipost_django/submissions/refereeing_cycles.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scipost_django/submissions/refereeing_cycles.py b/scipost_django/submissions/refereeing_cycles.py index 8405aae85..d78f78818 100644 --- a/scipost_django/submissions/refereeing_cycles.py +++ b/scipost_django/submissions/refereeing_cycles.py @@ -8,6 +8,8 @@ from django.urls import reverse from django.utils import timezone from django.utils.html import format_html, format_html_join, html_safe +from common.utils import get_current_domain + from . import constants @@ -89,6 +91,12 @@ class BaseAction: print deadline = obj.submission.reporting_deadline - timezone.now() + # Add the domain name to the url so that it is clickable in the email + if self.url.startswith("/"): + base_url = "https://" + get_current_domain() + self.url + else: + base_url = self.url + return text.format( count=len(self._objects), object=obj.__class__.__name__, @@ -99,7 +107,7 @@ class BaseAction: days=timedelta.days, deadline=deadline.days, deadline_min=-deadline.days, - url=self.url, + url=base_url, url2=self.url2, ) -- GitLab