mirror of
https://github.com/django/django.git
synced 2025-11-02 21:03:53 +00:00
Fixed #12285. ModelForm raises a more informative error if it doesn't have a model class defined. Thanks, tobias.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12526 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
7aeb37d610
commit
8da76ffeaa
2 changed files with 8 additions and 1 deletions
|
|
@ -145,5 +145,10 @@ class CustomModelFormSaveMethod(TestCase):
|
|||
data = {'name': 'anonymous'}
|
||||
form = RealPersonForm(data)
|
||||
self.assertEqual(form.is_valid(), False)
|
||||
self.assertEqual(form.errors['__all__'], ['Please specify a real name.'])
|
||||
self.assertEqual(form.errors['__all__'], ['Please specify a real name.'])
|
||||
|
||||
class ModelClassTests(TestCase):
|
||||
def test_no_model_class(self):
|
||||
class NoModelModelForm(forms.ModelForm):
|
||||
pass
|
||||
self.assertRaises(ValueError, NoModelModelForm)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue