diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2006-06-07 02:46:08 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2006-06-07 02:46:08 +0000 |
| commit | f3f002b1610ac51044e1e6dff5b7ff8f00b9f4dd (patch) | |
| tree | 86e7fc9d0efa225a76bff975bbea2e7af856eb3a /django | |
| parent | 448becefdf1e84f143720a01fd1e61869ffe4e5f (diff) | |
Fixed #1697 and #2095 -- Made 'choices' parameter accept any iterable
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3094 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
| -rw-r--r-- | django/core/management.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/django/core/management.py b/django/core/management.py index 931372cc5e..d3649b4d48 100644 --- a/django/core/management.py +++ b/django/core/management.py @@ -836,8 +836,8 @@ def get_validation_errors(outfile, app=None): if f.prepopulate_from is not None and type(f.prepopulate_from) not in (list, tuple): e.add(opts, '"%s": 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": "choices" should be either a tuple or list.' % f.name) + if not hasattr(f.choices, '__iter__'): + e.add(opts, '"%s": "choices" should be iterable (e.g., a tuple or list).' % f.name) else: for c in f.choices: if not type(c) in (tuple, list) or len(c) != 2: |
