Skip to content
Snippets Groups Projects
Commit eabe983c authored by Todd Dembrey's avatar Todd Dembrey
Browse files

Fix errors introduced by the rebase

parent e166d9e2
No related branches found
No related tags found
No related merge requests found
...@@ -7,8 +7,8 @@ from django.core.serializers.json import DjangoJSONEncoder ...@@ -7,8 +7,8 @@ from django.core.serializers.json import DjangoJSONEncoder
from django.db import models from django.db import models
from django.db.models import Q from django.db.models import Q
from django.db.models.expressions import RawSQL, OrderBy from django.db.models.expressions import RawSQL, OrderBy
from django.db.utils import IntegrityError
from django.http import Http404 from django.http import Http404
from django.template.loader import render_to_string
from django.urls import reverse from django.urls import reverse
from django.utils.text import mark_safe from django.utils.text import mark_safe
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
...@@ -24,6 +24,7 @@ from wagtail.wagtailadmin.edit_handlers import ( ...@@ -24,6 +24,7 @@ from wagtail.wagtailadmin.edit_handlers import (
TabbedInterface TabbedInterface
) )
from wagtail.wagtailadmin.utils import send_mail
from wagtail.wagtailcore.fields import StreamField from wagtail.wagtailcore.fields import StreamField
from wagtail.wagtailcore.models import Orderable, Page from wagtail.wagtailcore.models import Orderable, Page
from wagtail.wagtailforms.models import AbstractEmailForm, AbstractFormSubmission from wagtail.wagtailforms.models import AbstractEmailForm, AbstractFormSubmission
...@@ -106,6 +107,19 @@ class DefinableWorkflowStreamForm(AbstractEmailForm, AbstractStreamForm): ...@@ -106,6 +107,19 @@ class DefinableWorkflowStreamForm(AbstractEmailForm, AbstractStreamForm):
def workflow_class(self): def workflow_class(self):
return WORKFLOW_CLASS[self.get_workflow_display()] return WORKFLOW_CLASS[self.get_workflow_display()]
def send_confirmation_email(self, form, cleaned_data):
email = cleaned_data.get('email')
context = {
'name': cleaned_data.get('full_name'),
'email': email,
'project_name': cleaned_data.get('title'),
'extra_text': self.confirmation_text_extra,
'fund_type': self.title,
}
subject = self.subject if self.subject else 'Thank You for Your submission to Open Technology Fund'
send_mail(subject, render_to_string('funds/email/confirmation.txt', context), (email,), self.from_address, )
content_panels = AbstractStreamForm.content_panels + [ content_panels = AbstractStreamForm.content_panels + [
FieldPanel('workflow'), FieldPanel('workflow'),
InlinePanel('forms', label="Forms"), InlinePanel('forms', label="Forms"),
...@@ -210,6 +224,10 @@ class Round(SubmittableStreamForm): ...@@ -210,6 +224,10 @@ class Round(SubmittableStreamForm):
**kwargs, **kwargs,
) )
def send_confirmation_email(self, form, cleaned_data):
# Parent holds the configuration about emails
self.get_parent().specific.send_confirmation_email(form, cleaned_data)
def get_defined_fields(self): def get_defined_fields(self):
# Only return the first form, will need updating for when working with 2 stage WF # Only return the first form, will need updating for when working with 2 stage WF
return self.get_parent().specific.forms.all()[0].fields return self.get_parent().specific.forms.all()[0].fields
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment