Code

Ticket #11859: t11859.diff

File t11859.diff, 844 bytes (added by Alex, 4 years ago)
Line 
1diff --git a/django/core/management/validation.py b/django/core/management/validation.py
2index 9b65b8e..ddf454f 100644
3--- a/django/core/management/validation.py
4+++ b/django/core/management/validation.py
5@@ -62,7 +62,7 @@ def get_validation_errors(outfile, app=None):
6                     e.add(opts, '"%s": "choices" should be iterable (e.g., a tuple or list).' % f.name)
7                 else:
8                     for c in f.choices:
9-                        if not type(c) in (tuple, list) or len(c) != 2:
10+                        if not isinstance(c, (list, tuple)) or len(c) != 2:
11                             e.add(opts, '"%s": "choices" should be a sequence of two-tuples.' % f.name)
12             if f.db_index not in (None, True, False):
13                 e.add(opts, '"%s": "db_index" should be either None, True or False.' % f.name)