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
- Automatic Manager Choice Filters by nipuL 3 years ago
- Model Choices Helper by pmclanahan 2 years ago
- Handling choices the right way by mallipeddi 4 years, 3 months ago
- ModelMixin by eallik 1 year, 3 months ago
- Online boolean switch in the admin list by sasha 4 years, 5 months ago
Comments
This class if freaking awesome!
#