Browse files

Improved model validator to make sure prepopulate_from is a list or t…


git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 6d92319 commit 5c22b8b4b78a9d99505495aa0abe7ffa91f6d108 @adrianholovaty adrianholovaty committed Sep 2, 2005
Showing with 2 additions and 0 deletions.
  1. +2 −0 django/core/
@@ -520,6 +520,8 @@ def get_validation_errors(outfile):
for f in opts.fields:
if isinstance(f, meta.CharField) and f.maxlength in (None, 0):
e.add(opts, '"%s" field: CharFields require a "maxlength" attribute.' %
+ if f.prepopulate_from is not None and type(f.prepopulate_from) not in (list, tuple):
+ e.add(opts, '"%s" field: prepopulate_from should be a list or tuple.' %
if f.choices:
if not type(f.choices) in (tuple, list):
e.add(opts, '"%s" field: "choices" should be either a tuple or list.' %

0 comments on commit 5c22b8b

Please sign in to comment.