diff options
| author | Claude Paroz <claude@2xlibre.net> | 2013-02-23 18:29:56 +0100 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2013-02-23 18:32:29 +0100 |
| commit | cc53d9b30bd73c12413c28101d5db9f9f4df517c (patch) | |
| tree | 6cffa178f7c78444d86ad6bfb34893215ffe0e45 /django/forms | |
| parent | a05ab448f7a738d30ee7e8a513a65b6a67e8ea8e (diff) | |
Fixed #15877 -- Improved exception when ModelForm has no model class
Thanks theaspect at gmail.com for the report and volrath for the
patch.
Diffstat (limited to 'django/forms')
| -rw-r--r-- | django/forms/models.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/django/forms/models.py b/django/forms/models.py index d545a07488..75d526d173 100644 --- a/django/forms/models.py +++ b/django/forms/models.py @@ -233,9 +233,9 @@ class BaseModelForm(BaseForm): initial=None, error_class=ErrorList, label_suffix=':', empty_permitted=False, instance=None): opts = self._meta + if opts.model is None: + raise ValueError('ModelForm has no model class specified.') 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 = {} |
