Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

…uple

git-svn-id: http://code.djangoproject.com/svn/django/trunk@617 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 5c22b8b4b78a9d99505495aa0abe7ffa91f6d108 1 parent 6d92319
Adrian Holovaty authored

Showing 1 changed file with 2 additions and 0 deletions. Show diff stats Hide diff stats

  1. 2  django/core/management.py
2  django/core/management.py
@@ -520,6 +520,8 @@ def get_validation_errors(outfile):
520 520
             for f in opts.fields:
521 521
                 if isinstance(f, meta.CharField) and f.maxlength in (None, 0):
522 522
                     e.add(opts, '"%s" field: CharFields require a "maxlength" attribute.' % f.name)
  523
+                if f.prepopulate_from is not None and type(f.prepopulate_from) not in (list, tuple):
  524
+                    e.add(opts, '"%s" field: prepopulate_from should be a list or tuple.' % f.name)
523 525
                 if f.choices:
524 526
                     if not type(f.choices) in (tuple, list):
525 527
                         e.add(opts, '"%s" field: "choices" should be either a tuple or list.' % f.name)

0 notes on commit 5c22b8b

Please sign in to comment.
Something went wrong with that request. Please try again.