コード例 #1
0
def fix_choices_arg(kwargs):
    '''allows the programmer to define choices as a list of values rather
    than (value, display_value)

    '''
    choices = kwargs.get('choices')
    if not choices:
        return
    choices = expand_choice_tuples(choices)
    kwargs['choices'] = choices
コード例 #2
0
 def get_FIELD_display(self):
     choices = getattr(self, field.name + '_choices')()
     value = getattr(self, field.attname)
     return dict(expand_choice_tuples(choices))[value]