Skip to content

Commit

Permalink
Fixed a few more spots related to #11859. Thanks, cramm and Alex Gaynor.
Browse files Browse the repository at this point in the history
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12537 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
jkocherhans committed Feb 23, 2010
1 parent 0f17695 commit 7352238
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions django/db/models/fields/__init__.py
Expand Up @@ -196,7 +196,7 @@ def validate(self, value, model_instance):
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:
Expand Down Expand Up @@ -431,7 +431,7 @@ def _get_flatchoices(self):
"""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))
Expand Down
2 changes: 1 addition & 1 deletion django/forms/fields.py
Expand Up @@ -621,7 +621,7 @@ def validate(self, value):
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):
Expand Down

0 comments on commit 7352238

Please sign in to comment.