def __str__(self): data = django.forms.models.model_to_dict(self) data.update( dict( style_label=_('Style'), transition_effect_label=_('Transition Effect'), ride_label=_('Ride'), interval_label=_('Interval'), aspect_ratio_label=_('Aspect Ratio'), )) fields = [ 'style', 'transition_effect', 'ride', 'interval', 'aspect_ratio', ] if not data['ride']: fields.remove('interval') return ', '.join([ '{key}: {value}'.format(key=data['{}_label'.format(field)], value=data[field]) for field in fields ])
def __str__(self): data = django.forms.models.model_to_dict(self) data.update(dict( style_label=_('Style'), transition_effect_label=_('Transition effect'), ride_label=_('Ride'), interval_label=_('Interval'), aspect_ratio_label=_('Aspect ratio'), )) fields = [ 'style', 'transition_effect', 'ride', 'interval', 'aspect_ratio', ] if not data['ride']: fields.remove('interval') return ', '.join([ '{key}: {value}'.format( key=data['{}_label'.format(field)], value=data[field] ) for field in fields ])