feat: Add adoption notice template for contacting a person directly
This commit is contained in:
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 5.2.1 on 2025-09-05 14:04
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('fellchensammlung', '0062_alter_adoptionnotice_adoption_notice_status_and_more'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='adoptionnotice',
|
||||||
|
name='adoption_process',
|
||||||
|
field=models.TextField(blank=True, choices=[('contact_person_in_an', 'Kontaktiere die Person im Vermittlungstext')], max_length=64, null=True, verbose_name='Adoptionsprozess'),
|
||||||
|
),
|
||||||
|
]
|
@@ -11,7 +11,7 @@ from .tools import misc, geo
|
|||||||
from notfellchen.settings import MEDIA_URL, base_url
|
from notfellchen.settings import MEDIA_URL, base_url
|
||||||
from .tools.geo import LocationProxy, Position
|
from .tools.geo import LocationProxy, Position
|
||||||
from .tools.misc import time_since_as_hr_string
|
from .tools.misc import time_since_as_hr_string
|
||||||
from .tools.model_helpers import NotificationTypeChoices, AdoptionNoticeStatusChoices
|
from .tools.model_helpers import NotificationTypeChoices, AdoptionNoticeStatusChoices, AdoptionProcess
|
||||||
from .tools.model_helpers import ndm as NotificationDisplayMapping
|
from .tools.model_helpers import ndm as NotificationDisplayMapping
|
||||||
|
|
||||||
|
|
||||||
@@ -391,6 +391,9 @@ class AdoptionNotice(models.Model):
|
|||||||
owner = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name=_('Creator'))
|
owner = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name=_('Creator'))
|
||||||
adoption_notice_status = models.TextField(max_length=64, verbose_name=_('Status'),
|
adoption_notice_status = models.TextField(max_length=64, verbose_name=_('Status'),
|
||||||
choices=AdoptionNoticeStatusChoices.all_choices())
|
choices=AdoptionNoticeStatusChoices.all_choices())
|
||||||
|
adoption_process = models.TextField(null=True, blank=True,
|
||||||
|
max_length=64, verbose_name=_('Adoptionsprozess'),
|
||||||
|
choices=AdoptionProcess)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def animals(self):
|
def animals(self):
|
||||||
|
@@ -0,0 +1,7 @@
|
|||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
<div class="content">
|
||||||
|
{% translate 'Kontaktiere die Person mit den Kontaktdaten in der Beschreibung.' %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
@@ -104,10 +104,21 @@ class AdoptionNoticeStatusChoicesDescriptions:
|
|||||||
_ansc.Closed.NOT_OPEN_ANYMORE: _("Tier(e) stehen nicht mehr zur Vermittlung bereit."),
|
_ansc.Closed.NOT_OPEN_ANYMORE: _("Tier(e) stehen nicht mehr zur Vermittlung bereit."),
|
||||||
_ansc.Closed.OTHER: _("Vermittlung geschlossen."),
|
_ansc.Closed.OTHER: _("Vermittlung geschlossen."),
|
||||||
|
|
||||||
_ansc.AwaitingAction.WAITING_FOR_REVIEW: _("Deaktiviert bis Moderator*innen die Vermittlung prüfen können."),
|
_ansc.AwaitingAction.WAITING_FOR_REVIEW: _(
|
||||||
|
"Deaktiviert bis Moderator*innen die Vermittlung prüfen können."),
|
||||||
_ansc.AwaitingAction.NEEDS_ADDITIONAL_INFO: _("Deaktiviert bis Informationen nachgetragen werden."),
|
_ansc.AwaitingAction.NEEDS_ADDITIONAL_INFO: _("Deaktiviert bis Informationen nachgetragen werden."),
|
||||||
|
|
||||||
_ansc.Disabled.AGAINST_RULES: _("Vermittlung deaktiviert da sie gegen die Regeln verstößt."),
|
_ansc.Disabled.AGAINST_RULES: _("Vermittlung deaktiviert da sie gegen die Regeln verstößt."),
|
||||||
_ansc.Disabled.UNCHECKED: _("Vermittlung deaktiviert bis sie vom Team auf Aktualität geprüft wurde."),
|
_ansc.Disabled.UNCHECKED: _("Vermittlung deaktiviert bis sie vom Team auf Aktualität geprüft wurde."),
|
||||||
_ansc.Disabled.OTHER: _("Vermittlung deaktiviert.")
|
_ansc.Disabled.OTHER: _("Vermittlung deaktiviert.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class AdoptionProcess(TextChoices):
|
||||||
|
CONTACT_PERSON_IN_AN = "contact_person_in_an", _("Kontaktiere die Person im Vermittlungstext")
|
||||||
|
|
||||||
|
|
||||||
|
class AdoptionNoticeProcessTemplates:
|
||||||
|
_bp = "fellchensammlung/partials/adoption_process/" # Base path for ease
|
||||||
|
mapping = {AdoptionProcess.CONTACT_PERSON_IN_AN: f"{_bp}contact_person_in_an.html",
|
||||||
|
}
|
||||||
|
@@ -36,7 +36,7 @@ from .tools.admin import clean_locations, get_unchecked_adoption_notices, deacti
|
|||||||
from .tasks import post_adoption_notice_save
|
from .tasks import post_adoption_notice_save
|
||||||
from rest_framework.authtoken.models import Token
|
from rest_framework.authtoken.models import Token
|
||||||
|
|
||||||
from .tools.model_helpers import AdoptionNoticeStatusChoices
|
from .tools.model_helpers import AdoptionNoticeStatusChoices, AdoptionNoticeProcessTemplates
|
||||||
from .tools.search import AdoptionNoticeSearch, RescueOrgSearch
|
from .tools.search import AdoptionNoticeSearch, RescueOrgSearch
|
||||||
|
|
||||||
|
|
||||||
@@ -170,10 +170,17 @@ def adoption_notice_detail(request, adoption_notice_id):
|
|||||||
return HttpResponseForbidden()
|
return HttpResponseForbidden()
|
||||||
else:
|
else:
|
||||||
comment_form = CommentForm(instance=adoption_notice)
|
comment_form = CommentForm(instance=adoption_notice)
|
||||||
|
|
||||||
|
# Set the adoption notice template, use default when not set
|
||||||
|
if adoption_notice.adoption_process is not None:
|
||||||
|
adoption_process_template = AdoptionNoticeProcessTemplates.mapping[adoption_notice.adoption_process]
|
||||||
|
else:
|
||||||
|
adoption_process_template = "fellchensammlung/partials/adoption_process/generic.html"
|
||||||
|
|
||||||
context = {"adoption_notice": adoption_notice, "comment_form": comment_form, "user": request.user,
|
context = {"adoption_notice": adoption_notice, "comment_form": comment_form, "user": request.user,
|
||||||
"has_edit_permission": has_edit_permission, "is_subscribed": is_subscribed,
|
"has_edit_permission": has_edit_permission, "is_subscribed": is_subscribed,
|
||||||
"adoption_notice_meta": adoption_notice_meta,
|
"adoption_notice_meta": adoption_notice_meta,
|
||||||
"adoption_process_template": "fellchensammlung/partials/adoption_process/generic.html",
|
"adoption_process_template": adoption_process_template,
|
||||||
"oxitraffic_base_url": settings.OXITRAFFIC_BASE_URL}
|
"oxitraffic_base_url": settings.OXITRAFFIC_BASE_URL}
|
||||||
return render(request, 'fellchensammlung/details/detail-adoption-notice.html', context=context)
|
return render(request, 'fellchensammlung/details/detail-adoption-notice.html', context=context)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user