Ticket #1697: iterable.diff

File iterable.diff, 849 bytes (added by brantley, 19 years ago)

patch

  • management.py

     
    822822            if f.prepopulate_from is not None and type(f.prepopulate_from) not in (list, tuple):
    823823                e.add(opts, '"%s": prepopulate_from should be a list or tuple.' % f.name)
    824824            if f.choices:
    825                 if not type(f.choices) in (tuple, list):
    826                     e.add(opts, '"%s": "choices" should be either a tuple or list.' % f.name)
     825                if not hasattr(f.choices, '__iter__'):
     826                    e.add(opts, '"%s": "choices" needs to be an iterable such as a list or tuple.' % f.name)
    827827                else:
    828828                    for c in f.choices:
    829829                        if not type(c) in (tuple, list) or len(c) != 2:
Back to Top