Improved error handling for invalid model parameters that aren't custom functions.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@502 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
e004d2a0f7
commit
4a7159865e
|
@ -464,6 +464,7 @@ class ModelBase(type):
|
||||||
for k, v in attrs.items():
|
for k, v in attrs.items():
|
||||||
if k in ('__module__', '__init__', '_overrides', '__doc__'):
|
if k in ('__module__', '__init__', '_overrides', '__doc__'):
|
||||||
continue # Skip the important stuff.
|
continue # Skip the important stuff.
|
||||||
|
assert callable(v), "%r is an invalid model parameter." % k
|
||||||
# Give the function a function attribute "custom" to designate that
|
# Give the function a function attribute "custom" to designate that
|
||||||
# it's a custom function/method.
|
# it's a custom function/method.
|
||||||
v.custom = True
|
v.custom = True
|
||||||
|
|
Loading…
Reference in New Issue