1 2 3 4 5 6 7 8 9 | class Choices(object):
def __init__(self, *args):
self._choices = []
for i, arg in enumerate(args):
setattr(self, arg[0], i)
self._choices.append((i, arg[1]))
def __iter__(self):
return iter(self._choices)
|
More like this
- i18n base model for translatable content by foxbunny 4 years, 10 months ago
- Handling choices the right way by mallipeddi 5 years, 6 months ago
- Automatic Manager Choice Filters by nipuL 4 years, 4 months ago
- Dynamic tabular inlines with optional drag-n-drop sorting by Aneon 4 years ago
- MultiSelectField with comma separated values (Field + FormField) by quinode 1 year ago
Comments
This class if freaking awesome!
#