|
|
|
@ -9,6 +9,7 @@ import re
|
|
|
|
|
|
|
|
|
|
from django import forms
|
|
|
|
|
from .forms import NominationForm
|
|
|
|
|
from .models import Nomination
|
|
|
|
|
|
|
|
|
|
@processor_for("nominierungen")
|
|
|
|
|
def sendNomination(request, page=None):
|
|
|
|
@ -22,27 +23,17 @@ def sendNomination(request, page=None):
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
|
|
name = form.cleaned_data['name']
|
|
|
|
|
email = form.cleaned_data['email']
|
|
|
|
|
nominated = form.cleaned_data['nominated']
|
|
|
|
|
reasons_nomination = form.cleaned_data['reasons_nomination']
|
|
|
|
|
|
|
|
|
|
subject = 'Nomination sumbitted'
|
|
|
|
|
message = ''
|
|
|
|
|
|
|
|
|
|
if name != '':
|
|
|
|
|
message += 'Name: ' + name
|
|
|
|
|
if email != '':
|
|
|
|
|
message += ' Email: ' + email
|
|
|
|
|
|
|
|
|
|
message += ' Nominated: ' + nominated + ' Reasons: ' + reasons_nomination
|
|
|
|
|
number = Nomination.objects.all().count()
|
|
|
|
|
subject = 'Nomination ' + str(number) + ' sumbitted'
|
|
|
|
|
message = "There's a new nomination on the website, check it out!"
|
|
|
|
|
from_email = 'no-reply@bba.pep.foundation'
|
|
|
|
|
recipient_list = ['bba-jury@pep.foundation']
|
|
|
|
|
|
|
|
|
|
email = EmailMessage(subject, message, from_email, recipient_list)
|
|
|
|
|
email.send()
|
|
|
|
|
|
|
|
|
|
except Exception:
|
|
|
|
|
except Exception as e:
|
|
|
|
|
print(e)
|
|
|
|
|
pass
|
|
|
|
|
# form.add_error(None, str(_('Fehler beim Senden des Formulars')))
|
|
|
|
|
# return {
|
|
|
|
|