summaryrefslogtreecommitdiff
path: root/tests/model_formsets
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2014-03-21 20:44:34 -0400
committerTim Graham <timograham@gmail.com>2014-03-22 07:56:48 -0400
commitee4edb1eda2ac8f09eb298929282b44776930c89 (patch)
tree385d5f30d927069256aa57d0b44ac377ac06dfcc /tests/model_formsets
parent1c8dbb0cc268c6a2edc8268776b440f64867e6fb (diff)
Made ModelForms raise ImproperlyConfigured if the list of fields is not specified.
Also applies to modelform(set)_factory and generic model views. refs #19733.
Diffstat (limited to 'tests/model_formsets')
-rw-r--r--tests/model_formsets/tests.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/model_formsets/tests.py b/tests/model_formsets/tests.py
index c1e01cd6be..4c7d2a535e 100644
--- a/tests/model_formsets/tests.py
+++ b/tests/model_formsets/tests.py
@@ -6,6 +6,7 @@ from datetime import date
from decimal import Decimal
from django import forms
+from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.forms.models import (_get_foreign_key, inlineformset_factory,
modelformset_factory, BaseModelFormSet)
@@ -131,6 +132,15 @@ class DeletionTests(TestCase):
class ModelFormsetTest(TestCase):
+ def test_modelformset_factory_without_fields(self):
+ """ Regression for #19733 """
+ message = (
+ "Calling modelformset_factory without defining 'fields' or 'exclude' "
+ "explicitly is prohibited."
+ )
+ with self.assertRaisesMessage(ImproperlyConfigured, message):
+ modelformset_factory(Author)
+
def test_simple_save(self):
qs = Author.objects.all()
AuthorFormSet = modelformset_factory(Author, fields="__all__", extra=3)