little corrections
This commit is contained in:
parent
acca5da39d
commit
f0c08ce0ba
2 changed files with 12 additions and 16 deletions
|
@ -10,8 +10,8 @@ from smtplib import SMTPException
|
||||||
from .forms import BirdAddForm, BirdEditForm
|
from .forms import BirdAddForm, BirdEditForm
|
||||||
from .models import Bird, FallenBird
|
from .models import Bird, FallenBird
|
||||||
|
|
||||||
from sendemail.models import BirdEmail
|
|
||||||
from sendemail.message import messagebody
|
from sendemail.message import messagebody
|
||||||
|
from sendemail.models import BirdEmail
|
||||||
|
|
||||||
env = environ.Env()
|
env = environ.Env()
|
||||||
|
|
||||||
|
@ -96,7 +96,10 @@ def bird_inactive(request):
|
||||||
@login_required(login_url="account_login")
|
@login_required(login_url="account_login")
|
||||||
def bird_single(request, id):
|
def bird_single(request, id):
|
||||||
bird = FallenBird.objects.get(id=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 request.method == "POST":
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
fs = form.save(commit=False)
|
fs = form.save(commit=False)
|
||||||
|
|
|
@ -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:
|
||||||
|
"""Returns the body of the message to be sent to UNB."""
|
||||||
|
body = f"""
|
||||||
def messagebody(
|
Sehr geehrte Damen und Herren,
|
||||||
date,
|
|
||||||
bird,
|
|
||||||
place,
|
|
||||||
diagnosis,
|
|
||||||
) -> str:
|
|
||||||
text = f"""
|
|
||||||
Guten Tag,
|
|
||||||
|
|
||||||
am {date} wurde in der NABU Wildvogelhilfe ein Vogel der Art {bird} aufgenomen.
|
am {date} wurde in der NABU Wildvogelhilfe ein Vogel der Art {bird} aufgenomen.
|
||||||
Der Fundort laut Finder*in war: {place}
|
Der Fundort laut Finder*in war: {place}.
|
||||||
Die Diagnose bei Fund lautet: {diagnosis}
|
Die Diagnose bei Fund lautet: {diagnosis}.
|
||||||
|
|
||||||
Mit freundlichen Grüßen
|
Mit freundlichen Grüßen
|
||||||
|
|
||||||
|
@ -22,4 +15,4 @@ def messagebody(
|
||||||
Schillergässchen 5
|
Schillergässchen 5
|
||||||
07745 Jena
|
07745 Jena
|
||||||
"""
|
"""
|
||||||
return text
|
return body
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue