|
@ -6,9 +6,11 @@ from django.core.mail import send_mail, BadHeaderError |
|
|
from django.conf import settings |
|
|
from django.conf import settings |
|
|
from django.template.loader import get_template |
|
|
from django.template.loader import get_template |
|
|
from django.template import Context |
|
|
from django.template import Context |
|
|
|
|
|
# from django.contrib.sites.models import Site |
|
|
|
|
|
|
|
|
from .forms import ProjectForm, VolunteerForm, LibraryForm, IFGForm |
|
|
from .forms import ProjectForm, VolunteerForm, LibraryForm, IFGForm |
|
|
from .models import Project, TYPE_CHOICES, Library |
|
|
from .models import Project, TYPE_CHOICES, Library |
|
|
|
|
|
from .settings import URLPREFIX, IF_EMAIL |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def set_granted_in_lib(key,b): |
|
|
def set_granted_in_lib(key,b): |
|
@ -123,8 +125,9 @@ class ExternView(CookieWizardView): |
|
|
form.type = data['choice'] |
|
|
form.type = data['choice'] |
|
|
form.save() |
|
|
form.save() |
|
|
|
|
|
|
|
|
# add primary key to context |
|
|
|
|
|
|
|
|
# add some data to context for mail templates |
|
|
data['pk'] = form.pk |
|
|
data['pk'] = form.pk |
|
|
|
|
|
data['urlprefix'] = URLPREFIX |
|
|
|
|
|
|
|
|
# we need to send the following mails here: |
|
|
# we need to send the following mails here: |
|
|
context = { 'data': data } |
|
|
context = { 'data': data } |
|
@ -134,7 +137,7 @@ class ExternView(CookieWizardView): |
|
|
send_mail( |
|
|
send_mail( |
|
|
'form filled', |
|
|
'form filled', |
|
|
mail_template.render(context), |
|
|
mail_template.render(context), |
|
|
settings.IF_EMAIL, |
|
|
|
|
|
|
|
|
IF_EMAIL, |
|
|
[form.email], |
|
|
[form.email], |
|
|
fail_silently=False, |
|
|
fail_silently=False, |
|
|
) |
|
|
) |
|
@ -143,8 +146,8 @@ class ExternView(CookieWizardView): |
|
|
send_mail( |
|
|
send_mail( |
|
|
'form filled', |
|
|
'form filled', |
|
|
mail_template.render(context), |
|
|
mail_template.render(context), |
|
|
settings.IF_EMAIL, |
|
|
|
|
|
[settings.IF_EMAIL], |
|
|
|
|
|
|
|
|
IF_EMAIL, |
|
|
|
|
|
[IF_EMAIL], |
|
|
fail_silently=False, |
|
|
fail_silently=False, |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|