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 %}
{# djlint:off H021 #} - Contact + Contact {# djlint:on #} {% if contact %} {% if contact.name or contact.point_of_contact_for %} diff --git a/integreat_cms/cms/views/utils/contact_utils.py b/integreat_cms/cms/views/utils/contact_utils.py index 206d739e4a..17159a3f1b 100644 --- a/integreat_cms/cms/views/utils/contact_utils.py +++ b/integreat_cms/cms/views/utils/contact_utils.py @@ -7,7 +7,6 @@ from django.core.exceptions import PermissionDenied from django.http import HttpResponse, JsonResponse from django.shortcuts import get_object_or_404, render -from django.urls import reverse from django.views.decorators.http import require_POST from ...decorators import permission_required @@ -53,10 +52,7 @@ def search_contact_ajax( { "data": [ { - "url": reverse( - "get_contact", - kwargs={"contact_id": result.id, "region_slug": region_slug}, - ), + "url": result.absolute_url, "name": result.get_repr_short, } for result in results diff --git a/integreat_cms/static/src/js/forms/tinymce-init.ts b/integreat_cms/static/src/js/forms/tinymce-init.ts index 0042e14031..37d402cb45 100644 --- a/integreat_cms/static/src/js/forms/tinymce-init.ts +++ b/integreat_cms/static/src/js/forms/tinymce-init.ts @@ -107,6 +107,7 @@ window.addEventListener("load", () => { link_default_target: "", document_base_url: tinymceConfig.getAttribute("data-webapp-url"), relative_urls: false, + convert_urls: false, remove_script_host: false, branding: false, paste_as_text: true,