Ticket #11192: ModelForms_checks.patch
File ModelForms_checks.patch, 785 bytes (added by , 15 years ago) |
---|
-
models.py
215 215 opts = self._meta 216 216 if instance is None: 217 217 # if we didn't get an instance, instantiate a new one 218 219 # we should to check if model is in opts before creating instance 220 if not hasattr(opts, 'model') or opts.model is None: 221 raise ValueError('model attribute is not set in ModelForm or None') 222 223 # and need to check if instance is callable 224 if not callable(opts.model): 225 raise TypeError('model should be callable') 226 218 227 self.instance = opts.model() 219 228 object_data = {} 220 229 else: