summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2005-09-02 22:50:53 +0000
committerAdrian Holovaty <adrian@holovaty.com>2005-09-02 22:50:53 +0000
commit5c22b8b4b78a9d99505495aa0abe7ffa91f6d108 (patch)
tree5acd7205e1aa00c444899f455a505b17205a5ec5
parent6d92319838dd4fc9c96b569312702840d326d800 (diff)
Improved model validator to make sure prepopulate_from is a list or tuple
git-svn-id: http://code.djangoproject.com/svn/django/trunk@617 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/core/management.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/django/core/management.py b/django/core/management.py
index 1924c85536..7c56536ec2 100644
--- a/django/core/management.py
+++ b/django/core/management.py
@@ -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.' % f.name)
+ 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.' % f.name)
if f.choices:
if not type(f.choices) in (tuple, list):
e.add(opts, '"%s" field: "choices" should be either a tuple or list.' % f.name)