Ticket #11859: validation.diff

File validation.diff, 836 bytes (added by paluh, 6 years ago)
  • django/core/management/validation.py

    5858                    e.add(opts, '"%s": "choices" should be iterable (e.g., a tuple or list).' % f.name)
    5959                else:
    6060                    for c in f.choices:
    61                         if not type(c) in (tuple, list) or len(c) != 2:
     61                        if not (isinstance(c, tuple) or isinstance(c, list)) or len(c) != 2:
    6262                            e.add(opts, '"%s": "choices" should be a sequence of two-tuples.' % f.name)
    6363            if f.db_index not in (None, True, False):
    6464                e.add(opts, '"%s": "db_index" should be either None, True or False.' % f.name)
Back to Top