Change method name to AbstractEmailForm.send_mail

Also contails release notes for #2926
pull/2812/head
Mikalai Radchuk 2016-08-26 12:06:23 +03:00
rodzic 2403be5938
commit b37e8ccbcf
4 zmienionych plików z 5 dodań i 2 usunięć

Wyświetl plik

@ -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)

Wyświetl plik

@ -161,6 +161,7 @@ Contributors
* Fábio Macêdo Mendes
* Eraldo Energy
* Jesse Legg
* Tim Leguijt
Translators
===========

Wyświetl plik

@ -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

Wyświetl plik

@ -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,)