1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #25548 -- Prevented FormView.form_invalid() from discarding its form argument.

This commit is contained in:
Alex Morozov
2015-11-10 16:06:59 +03:00
committed by Simon Charette
parent cc8c02fa0f
commit e171a83b15
4 changed files with 20 additions and 1 deletions

View File

@@ -71,6 +71,13 @@ class BasicFormTests(TestCase):
res = self.client.post('/contact/', {'name': "Me", 'message': "Hello"})
self.assertRedirects(res, '/list/authors/')
def test_late_form_validation(self):
"""
A form can be marked invalid in the form_valid() method (#25548).
"""
res = self.client.post('/late-validation/', {'name': "Me", 'message': "Hello"})
self.assertFalse(res.context['form'].is_valid())
class ModelFormMixinTests(SimpleTestCase):
def test_get_form(self):