Skip to content

Commit

Permalink
Change method name to AbstractEmailForm.send_mail
Browse files Browse the repository at this point in the history
Also contails release notes for #2926
  • Loading branch information
m1kola committed Aug 26, 2016
1 parent 2403be5 commit b37e8cc
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.txt
Expand Up @@ -5,6 +5,7 @@ Changelog
~~~~~~~~~~~~~~~~

* The Wagtail version number can now be obtained as a tuple using `from wagtail import VERSION` (Tim Heap)
* ``send_mail`` logic has been moved from ``AbstractEmailForm.process_form_submission`` into ``AbstractEmailForm.send_mail``. Now it's easier to override this logic (Tim Leguijt)
* Fix: Migrations for wagtailcore and project template are now reversible (Benjamin Bach)
* Fix: The default image format label text ('Full width', 'Left-aligned', 'Right-aligned') is now localised (Mikalai Radchuk)

Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.rst
Expand Up @@ -161,6 +161,7 @@ Contributors
* Fábio Macêdo Mendes
* Eraldo Energy
* Jesse Legg
* Tim Leguijt

Translators
===========
Expand Down
1 change: 1 addition & 0 deletions docs/releases/1.7.rst
Expand Up @@ -15,6 +15,7 @@ Minor features
~~~~~~~~~~~~~~

* The Wagtail version number can now be obtained as a tuple using ``from wagtail import VERSION`` (Tim Heap)
* ``send_mail`` logic has been moved from ``AbstractEmailForm.process_form_submission`` into ``AbstractEmailForm.send_mail``. Now it's easier to override this logic (Tim Leguijt)


Bug fixes
Expand Down
4 changes: 2 additions & 2 deletions wagtail/wagtailforms/models.py
Expand Up @@ -218,10 +218,10 @@ class AbstractEmailForm(AbstractForm):
def process_form_submission(self, form):
submission = super(AbstractEmailForm, self).process_form_submission(form)
if self.to_address:
self.send_form_mail(form)
self.send_mail(form)
return submission

def send_form_mail(self, form):
def send_mail(self, form):
addresses = [x.strip() for x in self.to_address.split(',')]
content = '\n'.join([x[1].label + ': ' + text_type(form.data.get(x[0])) for x in form.fields.items()])
send_mail(self.subject, content, addresses, self.from_address,)
Expand Down

0 comments on commit b37e8cc

Please sign in to comment.