mirror of
https://github.com/django/django.git
synced 2025-10-24 22:26:08 +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:
@@ -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 = {}
|
||||
|
||||
Reference in New Issue
Block a user