def get_available_themes(*args, **kwargs): """Return the available theme choices.""" themes = [] for key, name in ColorTheme.get_color_themes_choices(): themes.append({'key': key, 'name': name}) return themes
def __init__(self, *args, **kwargs): super(ColorThemeSelectForm, self).__init__(*args, **kwargs) # Populate color themes choices self.fields['name'].choices = ColorTheme.get_color_themes_choices() self.helper = FormHelper() # Form rendering self.helper.form_show_labels = False self.helper.layout = Layout( Div( Div(Field('name'), css_class='col-sm-6', style='width: 200px;'), Div(StrictButton(_('Apply Theme'), css_class='btn btn-primary', type='submit'), css_class='col-sm-6', style='width: auto;'), css_class='row', ), )