diff options
| author | Donald Stufft <donald@stufft.io> | 2013-05-18 11:31:16 -0400 |
|---|---|---|
| committer | Donald Stufft <donald@stufft.io> | 2013-05-18 11:31:16 -0400 |
| commit | 398841d6d3fce45b21bdfcd8385889098079f84a (patch) | |
| tree | 570b586cdb0de1871a28ccd429b7b5a765e7df23 /django | |
| parent | 78de9b19027d3aee268797ad8899ac7283024c0c (diff) | |
| parent | a19e9d80ffa10f8da43addcaa4ddd440beee8a4d (diff) | |
Merge branch 'allow-any-iterable-for-choices'
Diffstat (limited to 'django')
| -rw-r--r-- | django/core/management/validation.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/django/core/management/validation.py b/django/core/management/validation.py index 0f0eade569..2040a14582 100644 --- a/django/core/management/validation.py +++ b/django/core/management/validation.py @@ -118,8 +118,8 @@ def get_validation_errors(outfile, app=None): e.add(opts, '"%s": "choices" should be iterable (e.g., a tuple or list).' % f.name) else: for c in f.choices: - if not isinstance(c, (list, tuple)) or len(c) != 2: - e.add(opts, '"%s": "choices" should be a sequence of two-tuples.' % f.name) + if isinstance(c, six.string_types) or not is_iterable(c) or len(c) != 2: + e.add(opts, '"%s": "choices" should be a sequence of two-item iterables (e.g. list of 2 item tuples).' % f.name) if f.db_index not in (None, True, False): e.add(opts, '"%s": "db_index" should be either None, True or False.' % f.name) |
