diff options
| author | Joseph Kocherhans <joseph@jkocherhans.com> | 2010-02-23 18:27:51 +0000 |
|---|---|---|
| committer | Joseph Kocherhans <joseph@jkocherhans.com> | 2010-02-23 18:27:51 +0000 |
| commit | 7352238e16110c139031b01343379596830c48a3 (patch) | |
| tree | 675eba3ee1c8991876adebf31f4621b25bae3493 | |
| parent | 0f1769555e1d43ff83f3a715095ac28f24499c2a (diff) | |
Fixed a few more spots related to #11859. Thanks, cramm and Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12537 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/db/models/fields/__init__.py | 4 | ||||
| -rw-r--r-- | django/forms/fields.py | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index 4a3405f3f0..e9e3f4a0a3 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -196,7 +196,7 @@ class Field(object): return if self._choices and value: for option_key, option_value in self.choices: - if type(option_value) in (tuple, list): + if isinstance(option_value, (list, tuple)): # This is an optgroup, so look inside the group for options. for optgroup_key, optgroup_value in option_value: if value == optgroup_key: @@ -431,7 +431,7 @@ class Field(object): """Flattened version of choices tuple.""" flat = [] for choice, value in self.choices: - if type(value) in (list, tuple): + if isinstance(value, (list, tuple)): flat.extend(value) else: flat.append((choice,value)) diff --git a/django/forms/fields.py b/django/forms/fields.py index dd5ae1e427..6d0fdea26e 100644 --- a/django/forms/fields.py +++ b/django/forms/fields.py @@ -621,7 +621,7 @@ class ChoiceField(Field): def valid_value(self, value): "Check to see if the provided value is a valid choice" for k, v in self.choices: - if type(v) in (tuple, list): + if isinstance(v, (list, tuple)): # This is an optgroup, so look inside the group for options for k2, v2 in v: if value == smart_unicode(k2): |
