diff --git a/docs/user/tierschutzorganisation-hinzufuegen.rst b/docs/user/tierschutzorganisation-hinzufuegen.rst
new file mode 100644
index 0000000..e71778a
--- /dev/null
+++ b/docs/user/tierschutzorganisation-hinzufuegen.rst
@@ -0,0 +1,19 @@
+Tierschutzorganisation hinzufügen
+=================================
+
+Notfellchen führt eine Liste von Tierheime und anderer Tierschutzorganisationen. Die meisten Tierheime wurden von
+OpenStreetMap importiert.
+Ausnahmen stellen nicht-ortsgebunden Organisationen wie die Rattenhilfe Süd dar. Sie existieren nicht auf der Karte und
+können dort auch nicht sinnvoll verzeichnet werden, daher werden sie nur in Notfellchen geführt.
+
+.. warning::
+
+ Generell ist es besser eine Tierschutzorganisation in OpenStreetMap anzulegen, anstatt bei Notfellchen. Das
+ ermöglichtes anderen die Daten ebenfalls zu nutzen und sie werden ggf. durch die OpenStreetMap Community aktuell gehalten.
+
+Hier erklären wir aber trotzdem wie Tierheime direkt in Notfellchen hinzugefügt werden können, damit es schneller geht
+diese Anzulegen und ihnen Vermittlungen zuzuweisen.
+
+Organisationen in Notfellchen hinzufügen
+----------------------------------------
+
diff --git a/src/fellchensammlung/forms.py b/src/fellchensammlung/forms.py
index ebd2196..fb702d8 100644
--- a/src/fellchensammlung/forms.py
+++ b/src/fellchensammlung/forms.py
@@ -201,3 +201,14 @@ class CloseAdoptionNoticeForm(forms.ModelForm):
class Meta:
model = AdoptionNotice
fields = ('adoption_notice_status',)
+
+
+class RescueOrgForm(forms.ModelForm):
+ template_name = "fellchensammlung/forms/form_snippets.html"
+
+ class Meta:
+ model = RescueOrganization
+ fields = ('name', 'allows_using_materials', 'location_string', "email", "phone_number", "website", "instagram",
+ "facebook", "fediverse_profile", "internal_comment", "description", "external_source_identifier",
+ "external_object_identifier",
+ "parent_org")
diff --git a/src/fellchensammlung/models.py b/src/fellchensammlung/models.py
index 02a9f4b..f3b0853 100644
--- a/src/fellchensammlung/models.py
+++ b/src/fellchensammlung/models.py
@@ -167,10 +167,12 @@ class RescueOrganization(models.Model):
internal_comment = models.TextField(verbose_name=_("Interner Kommentar"), null=True, blank=True, )
description = models.TextField(null=True, blank=True, verbose_name=_('Beschreibung')) # Markdown allowed
external_object_identifier = models.CharField(max_length=200, null=True, blank=True,
- verbose_name=_('External Object Identifier'))
+ verbose_name=_('External Object Identifier'),
+ help_text=_("Id des Objekts in der externen Datenbank (kann leer gelassen werden)"))
external_source_identifier = models.CharField(max_length=200, null=True, blank=True,
choices=ExternalSourceChoices.choices,
- verbose_name=_('External Source Identifier'))
+ verbose_name=_('External Source Identifier'),
+ help_text=_("Name der Datenbank aus der die Tierschutzorganisation importiert wurde (kann leer gelassen werden)"))
exclude_from_check = models.BooleanField(default=False, verbose_name=_('Von Prüfung ausschließen'),
help_text=_("Organisation von der manuellen Überprüfung ausschließen, "
"z.B. weil Tiere nicht online geführt werden"))
@@ -183,7 +185,7 @@ class RescueOrganization(models.Model):
ongoing_communication = models.BooleanField(default=False, verbose_name=_('In aktiver Kommunikation'),
help_text=_(
"Es findet gerade Kommunikation zwischen Notfellchen und der Organisation statt."))
- parent_org = models.ForeignKey("RescueOrganization", on_delete=models.PROTECT, blank=True, null=True)
+ parent_org = models.ForeignKey("RescueOrganization", on_delete=models.PROTECT, blank=True, null=True, verbose_name=_("Übergeordnete Organisation"))
# allows to specify if a rescue organization has a specialization for dedicated species
specializations = models.ManyToManyField(Species, blank=True)
twenty_id = models.UUIDField(verbose_name=_("Twenty-ID"), null=True, blank=True,
diff --git a/src/fellchensammlung/templates/fellchensammlung/details/detail-rescue-organization.html b/src/fellchensammlung/templates/fellchensammlung/details/detail-rescue-organization.html
index 29d9a0d..22a4227 100644
--- a/src/fellchensammlung/templates/fellchensammlung/details/detail-rescue-organization.html
+++ b/src/fellchensammlung/templates/fellchensammlung/details/detail-rescue-organization.html
@@ -24,11 +24,20 @@
{% include "fellchensammlung/partials/rescue_orgs/partial-rescue-organization-contact.html" %}
-
+ {% trust_level "MODERATOR" as coordinator_trust_level %}
+ {% if request.user.trust_level >= coordinator_trust_level %}
+
+
+ {% endif %}
{% include "fellchensammlung/partials/partial-map.html" %}
diff --git a/src/fellchensammlung/templates/fellchensammlung/footer.html b/src/fellchensammlung/templates/fellchensammlung/footer.html
index 2a34ff0..b62849b 100644
--- a/src/fellchensammlung/templates/fellchensammlung/footer.html
+++ b/src/fellchensammlung/templates/fellchensammlung/footer.html
@@ -102,6 +102,10 @@
{% translate 'Moderationstools' %}
+
+
+ {% translate 'Tierschutzorganisation hinzufügen' %}
+
{% endif %}
{% if request.user.is_superuser %}
diff --git a/src/fellchensammlung/templates/fellchensammlung/forms/form-rescue-organization.html b/src/fellchensammlung/templates/fellchensammlung/forms/form-rescue-organization.html
new file mode 100644
index 0000000..904da40
--- /dev/null
+++ b/src/fellchensammlung/templates/fellchensammlung/forms/form-rescue-organization.html
@@ -0,0 +1,19 @@
+{% extends "fellchensammlung/base.html" %}
+{% load i18n %}
+{% load widget_tweaks %}
+
+{% block content %}
+
+ {% if rescue_org %}
+ {{ rescue_org.name }}
+ {% else %}
+ {% translate 'Tierschutzorganisation hinzufügen' %}
+ {% endif %}
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/src/fellchensammlung/urls.py b/src/fellchensammlung/urls.py
index ca391f3..1b203af 100644
--- a/src/fellchensammlung/urls.py
+++ b/src/fellchensammlung/urls.py
@@ -47,6 +47,9 @@ urlpatterns = [
path("tierschutzorganisationen/", views.list_rescue_organizations, name="rescue-organizations"),
path("tierschutzorganisationen/
/", views.detail_view_rescue_organization,
name="rescue-organization-detail"),
+ path("tierschutzorganisationen/add", views.rescue_org_create_or_update, name="rescue-organization-create"),
+ path("tierschutzorganisationen//edit", views.rescue_org_create_or_update,
+ name="rescue-organization-edit"),
path("tierschutzorganisationen//exkludieren", views.exclude_from_regular_check,
name="rescue-organization-exclude"),
path("tierschutzorganisationen/add-exclusion-reason", views.update_exclusion_reason,
diff --git a/src/fellchensammlung/views.py b/src/fellchensammlung/views.py
index 4b64ab5..ebea929 100644
--- a/src/fellchensammlung/views.py
+++ b/src/fellchensammlung/views.py
@@ -25,7 +25,8 @@ from .models import AdoptionNotice, Text, Animal, Rule, Image, Report, Moderatio
ImportantLocation, SpeciesSpecificURL, NotificationTypeChoices, SocialMediaPost
from .forms import AdoptionNoticeForm, ImageForm, ReportAdoptionNoticeForm, \
CommentForm, ReportCommentForm, AnimalForm, AdoptionNoticeFormAutoAnimal, SpeciesURLForm, RescueOrgInternalComment, \
- UpdateRescueOrgRegularCheckStatus, UserModCommentForm, CloseAdoptionNoticeForm, RescueOrgSearchByNameForm
+ UpdateRescueOrgRegularCheckStatus, UserModCommentForm, CloseAdoptionNoticeForm, RescueOrgSearchByNameForm, \
+ RescueOrgForm
from .models import Language, Announcement
from .tools import i18n, img
from .tools.fedi import post_an_to_fedi
@@ -1045,3 +1046,32 @@ def adoption_notice_sharepic(request, adoption_notice_id):
adoption_notice = get_object_or_404(AdoptionNotice, pk=adoption_notice_id)
svg_data = img.export_svg(adoption_notice)
return HttpResponse(svg_data, content_type="image/svg+xml")
+
+
+@login_required
+def rescue_org_create_or_update(request, rescue_organization_id=None):
+ """
+ Create or update a rescue organization
+ """
+ # Only users that are mods to create or edit it
+ if not user_is_trust_level_or_above(request.user, TrustLevel.MODERATOR):
+ return HttpResponseForbidden()
+ if rescue_organization_id:
+ rescue_org = get_object_or_404(RescueOrganization, pk=rescue_organization_id)
+ else:
+ rescue_org = None
+
+ if request.method == 'POST':
+ form = RescueOrgForm(request.POST, instance=rescue_org)
+
+ if form.is_valid():
+ rescue_org = form.save()
+
+ """Log"""
+ Log.objects.create(user=request.user, action="add_rescue_org",
+ text=f"{request.user} hat Tierschutzorganisation {rescue_org.pk} geändert")
+ return redirect(reverse("rescue-organization-detail", args=[rescue_org.pk], ))
+ else:
+ form = RescueOrgForm(instance=rescue_org)
+ return render(request, 'fellchensammlung/forms/form-rescue-organization.html',
+ context={"form": form, "rescue_org": rescue_org})