From c2412981cd7fe944cc6f2c7b11cfa1363cce1c39 Mon Sep 17 00:00:00 2001 From: MizukiTemma Date: Thu, 31 Oct 2024 10:14:19 +0100 Subject: [PATCH] Show related contacts in the POI form Co-authored-by: David Venhoff --- integreat_cms/cms/fixtures/test_data.json | 15 +++ integreat_cms/cms/models/contact/contact.py | 1 + .../cms/templates/pois/poi_form.html | 3 + .../related_contacts_box.html | 28 +++++ integreat_cms/locale/de/LC_MESSAGES/django.po | 20 +++- .../views/contacts/test_contact_actions.py | 16 +-- tests/cms/views/poi/test_poi_form.py | 103 ++++++++++++++++++ 7 files changed, 175 insertions(+), 11 deletions(-) create mode 100644 integreat_cms/cms/templates/pois/poi_form_sidebar/related_contacts_box.html diff --git a/integreat_cms/cms/fixtures/test_data.json b/integreat_cms/cms/fixtures/test_data.json index e420f1084c..873ad8574f 100644 --- a/integreat_cms/cms/fixtures/test_data.json +++ b/integreat_cms/cms/fixtures/test_data.json @@ -997,6 +997,21 @@ "created_date": "2024-08-06T13:23:45.256Z" } }, + { + "model": "cms.contact", + "pk": 4, + "fields": { + "title": "", + "name": "", + "location": 6, + "email": "generalcontactinformation@example.com", + "phone_number": "0123456789", + "website": "https://integreat-app.de/", + "archived": false, + "last_updated": "2024-08-06T13:23:45.256Z", + "created_date": "2024-08-06T13:23:45.256Z" + } + }, { "model": "cms.recurrencerule", "pk": 1, diff --git a/integreat_cms/cms/models/contact/contact.py b/integreat_cms/cms/models/contact/contact.py index c07395bc12..ecbba18787 100644 --- a/integreat_cms/cms/models/contact/contact.py +++ b/integreat_cms/cms/models/contact/contact.py @@ -2,6 +2,7 @@ from django.db.models import Q from django.utils import timezone from django.utils.functional import cached_property +from django.utils.translation import gettext from django.utils.translation import gettext_lazy as _ from ..abstract_base_model import AbstractBaseModel diff --git a/integreat_cms/cms/templates/pois/poi_form.html b/integreat_cms/cms/templates/pois/poi_form.html index e06df4ab7b..e8d38faf3a 100644 --- a/integreat_cms/cms/templates/pois/poi_form.html +++ b/integreat_cms/cms/templates/pois/poi_form.html @@ -167,6 +167,9 @@