little corrections

This commit is contained in:
Gunther Weissenbaeck 2024-02-06 00:29:29 +01:00
parent acca5da39d
commit f0c08ce0ba
2 changed files with 12 additions and 16 deletions

View file

@ -10,8 +10,8 @@ from smtplib import SMTPException
from .forms import BirdAddForm, BirdEditForm
from .models import Bird, FallenBird
from sendemail.models import BirdEmail
from sendemail.message import messagebody
from sendemail.models import BirdEmail
env = environ.Env()
@ -96,7 +96,10 @@ def bird_inactive(request):
@login_required(login_url="account_login")
def bird_single(request, id):
bird = FallenBird.objects.get(id=id)
form = BirdEditForm(request.POST or None, request.FILES or None, instance=bird)
form = BirdEditForm(
request.POST or None,
request.FILES or None,
instance=bird)
if request.method == "POST":
if form.is_valid():
fs = form.save(commit=False)

View file

@ -1,18 +1,11 @@
# the message body for the email should have placeholders for the bird name, the date found and the diagnosis
def messagebody(
date,
bird,
place,
diagnosis,
) -> str:
text = f"""
Guten Tag,
def messagebody(date, bird, place, diagnosis,) -> str:
"""Returns the body of the message to be sent to UNB."""
body = f"""
Sehr geehrte Damen und Herren,
am {date} wurde in der NABU Wildvogelhilfe ein Vogel der Art {bird} aufgenomen.
Der Fundort laut Finder*in war: {place}
Die Diagnose bei Fund lautet: {diagnosis}
Der Fundort laut Finder*in war: {place}.
Die Diagnose bei Fund lautet: {diagnosis}.
Mit freundlichen Grüßen
@ -22,4 +15,4 @@ def messagebody(
Schillergässchen 5
07745 Jena
"""
return text
return body