diff --git a/integreat_cms/cms/models/contact/contact.py b/integreat_cms/cms/models/contact/contact.py index 0e3217c271..68197a7352 100644 --- a/integreat_cms/cms/models/contact/contact.py +++ b/integreat_cms/cms/models/contact/contact.py @@ -6,6 +6,7 @@ from django.contrib.postgres.search import SearchQuery, SearchRank, SearchVector from django.db import models from django.db.models import Q +from django.urls import reverse from django.utils import timezone from django.utils.functional import cached_property from django.utils.translation import gettext @@ -266,6 +267,21 @@ def full_url(self) -> str: """ return f"{settings.BASE_URL}/{self.location.region.slug}/contact/{self.id}/" + @cached_property + def backend_edit_link(self) -> str: + """ + This function returns the absolute url to the edit form of this region + + :return: The url + """ + return reverse( + "edit_contact", + kwargs={ + "region_slug": self.region.slug, + "contact_id": self.id, + }, + ) + class Meta: verbose_name = _("contact") default_related_name = "contact" diff --git a/integreat_cms/cms/templates/ajax_contact_form/_contact_form_widget.html b/integreat_cms/cms/templates/ajax_contact_form/_contact_form_widget.html new file mode 100644 index 0000000000..9933001f6e --- /dev/null +++ b/integreat_cms/cms/templates/ajax_contact_form/_contact_form_widget.html @@ -0,0 +1,33 @@ +{% load i18n %} +{% load widget_tweaks %} +