Ticket #2095: choices.diff

File choices.diff, 836 bytes (added by Matias Hermanrud Fjeld, 18 years ago)
  • core/management.py

     
    836836            if f.prepopulate_from is not None and type(f.prepopulate_from) not in (list, tuple):
    837837                e.add(opts, '"%s": prepopulate_from should be a list or tuple.' % f.name)
    838838            if f.choices:
    839                 if not type(f.choices) in (tuple, list):
    840                     e.add(opts, '"%s": "choices" should be either a tuple or list.' % f.name)
     839                if not hasattr(f.choices, '__iter__'):
     840                    e.add(opts, '"%s": "choices" should be a sequence.' % f.name)
    841841                else:
    842842                    for c in f.choices:
    843843                        if not type(c) in (tuple, list) or len(c) != 2:
Back to Top