def __init__(self, *args, **kwargs): self.event = kwargs['obj'] super().__init__(*args, **kwargs) self.fields['confirm_text'].widget.attrs['rows'] = '3' self.fields['confirm_text'].widget.attrs['placeholder'] = _( 'e.g. I hereby confirm that I have read and agree with the event organizer\'s terms of service ' 'and agree with them.' ) self.fields['name_scheme'].choices = ( (k, _('Ask for {fields}, display like {example}').format( fields=' + '.join(str(vv[1]) for vv in v['fields']), example=v['concatenation'](v['sample']) )) for k, v in PERSON_NAME_SCHEMES.items() ) self.fields['name_scheme_titles'].choices = [('', _('Free text input'))] + [ (k, '{scheme}: {samples}'.format( scheme=v[0], samples=', '.join(v[1]) )) for k, v in PERSON_NAME_TITLE_GROUPS.items() ] if not self.event.has_subevents: del self.fields['frontpage_subevent_ordering'] del self.fields['event_list_type'] self.fields['primary_font'].choices += [ (a, {"title": a, "data": v}) for a, v in get_fonts().items() ]
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['name_scheme'].choices = ( (k, _('Ask for {fields}, display like {example}').format( fields=' + '.join(str(vv[1]) for vv in v['fields']), example=v['concatenation'](v['sample']))) for k, v in PERSON_NAME_SCHEMES.items()) self.fields['name_scheme_titles'].choices = [ ('', _('Free text input')) ] + [(k, '{scheme}: {samples}'.format(scheme=v[0], samples=', '.join(v[1]))) for k, v in PERSON_NAME_TITLE_GROUPS.items()]