diff --git a/integreat_cms/cms/models/contact/contact.py b/integreat_cms/cms/models/contact/contact.py index 0e3217c271..6053d529c6 100644 --- a/integreat_cms/cms/models/contact/contact.py +++ b/integreat_cms/cms/models/contact/contact.py @@ -182,7 +182,7 @@ def referring_page_translations(self) -> QuerySet[PageTranslation]: return PageTranslation.objects.filter( id__in=( Link.objects.filter( - url__url=self.full_url, + url__url=self.absolute_url, content_type=PageTranslationLinklist.content_type(), ).values("object_id") ), @@ -200,7 +200,7 @@ def referring_poi_translations(self) -> QuerySet[POITranslation]: return POITranslation.objects.filter( id__in=( Link.objects.filter( - url__url=self.full_url, + url__url=self.absolute_url, content_type=POITranslationLinklist.content_type(), ).values("object_id") ), @@ -218,7 +218,7 @@ def referring_event_translations(self) -> QuerySet[EventTranslation]: return EventTranslation.objects.filter( id__in=( Link.objects.filter( - url__url=self.full_url, + url__url=self.absolute_url, content_type=EventTranslationLinklist.content_type(), ).values("object_id") ), @@ -232,7 +232,8 @@ def referring_objects(self) -> Generator[AbstractContentTranslation]: :return: all objects referring to this contact """ return ( - link.content_object for link in Link.objects.filter(url__url=self.full_url) + link.content_object + for link in Link.objects.filter(url__url=self.absolute_url) ) def archive(self) -> None: @@ -258,13 +259,13 @@ def copy(self) -> None: self.save() @cached_property - def full_url(self) -> str: + def absolute_url(self) -> str: """ - This property returns the full url of this contact + This property returns the absolute url of this contact :return: The full url """ - return f"{settings.BASE_URL}/{self.location.region.slug}/contact/{self.id}/" + return f"/{self.location.region.slug}/contact/{self.id}/" class Meta: verbose_name = _("contact") diff --git a/integreat_cms/cms/templates/contacts/contact_card.html b/integreat_cms/cms/templates/contacts/contact_card.html index 630ddb576e..191bce298f 100644 --- a/integreat_cms/cms/templates/contacts/contact_card.html +++ b/integreat_cms/cms/templates/contacts/contact_card.html @@ -3,12 +3,12 @@ {% spaceless %}