fix TypeError if submitting unchecked BooleanField

pull/1260/merge
Arne Schauf 2015-05-02 21:21:35 +02:00 zatwierdzone przez Karl Hobley
rodzic cc07406f3d
commit 61584ae2f8
2 zmienionych plików z 1 dodań i 3 usunięć

Wyświetl plik

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

Wyświetl plik

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