kopia lustrzana https://github.com/wagtail/wagtail
fix TypeError if submitting unchecked BooleanField
rodzic
cc07406f3d
commit
61584ae2f8
|
@ -196,7 +196,7 @@ class AbstractEmailForm(AbstractForm):
|
||||||
super(AbstractEmailForm, self).process_form_submission(form)
|
super(AbstractEmailForm, self).process_form_submission(form)
|
||||||
|
|
||||||
if self.to_address:
|
if self.to_address:
|
||||||
content = '\n'.join([x[1].label + ': ' + form.data.get(x[0]) for x in form.fields.items()])
|
content = '\n'.join([x[1].label + ': ' + str(form.data.get(x[0])) for x in form.fields.items()])
|
||||||
send_mail(self.subject, content, [self.to_address], self.from_address,)
|
send_mail(self.subject, content, [self.to_address], self.from_address,)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import json
|
import json
|
||||||
import unittest
|
|
||||||
|
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.core import mail
|
from django.core import mail
|
||||||
|
@ -79,7 +78,6 @@ class TestFormSubmission(TestCase):
|
||||||
self.assertIn("bar", submission[0].form_data)
|
self.assertIn("bar", submission[0].form_data)
|
||||||
self.assertIn("baz", submission[0].form_data)
|
self.assertIn("baz", submission[0].form_data)
|
||||||
|
|
||||||
@unittest.expectedFailure
|
|
||||||
def test_post_blank_checkbox(self):
|
def test_post_blank_checkbox(self):
|
||||||
response = self.client.post('/contact-us/', {
|
response = self.client.post('/contact-us/', {
|
||||||
'your-email': 'bob@example.com',
|
'your-email': 'bob@example.com',
|
||||||
|
|
Ładowanie…
Reference in New Issue