summaryrefslogtreecommitdiff
path: root/django/forms/models.py
diff options
context:
space:
mode:
authorJoseph Kocherhans <joseph@jkocherhans.com>2010-02-23 14:59:30 +0000
committerJoseph Kocherhans <joseph@jkocherhans.com>2010-02-23 14:59:30 +0000
commit8da76ffeaa47547edb24f99a55f8c9e1a8986b90 (patch)
tree553e9e871c9829a1ef9710f58d7a748cb4bbb4c0 /django/forms/models.py
parent7aeb37d610700fe25b07d5e76b943cc3d51ab1a5 (diff)
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
Diffstat (limited to 'django/forms/models.py')
-rw-r--r--django/forms/models.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/django/forms/models.py b/django/forms/models.py
index e292c1b9a7..430dd4d7cc 100644
--- a/django/forms/models.py
+++ b/django/forms/models.py
@@ -236,6 +236,8 @@ class BaseModelForm(BaseForm):
empty_permitted=False, instance=None):
opts = self._meta
if instance is None:
+ if opts.model is None:
+ raise ValueError('ModelForm has no model class specified.')
# if we didn't get an instance, instantiate a new one
self.instance = opts.model()
object_data = {}