def _process(self): defaults = FormDefaults( self.category, meeting_theme=self.category.default_event_themes['meeting'], lecture_theme=self.category.default_event_themes['lecture']) form = CategorySettingsForm(obj=defaults, category=self.category) icon_form = CategoryIconForm(obj=self.category) logo_form = CategoryLogoForm(obj=self.category) if form.validate_on_submit(): update_category(self.category, form.data, skip={'meeting_theme', 'lecture_theme'}) self.category.default_event_themes = { 'meeting': form.meeting_theme.data, 'lecture': form.lecture_theme.data } flash(_("Category settings saved!"), 'success') return redirect(url_for('.manage_settings', self.category)) else: if self.category.icon_metadata: icon_form.icon.data = self.category if self.category.logo_metadata: logo_form.logo.data = self.category return WPCategoryManagement.render_template('management/settings.html', self.category, 'settings', form=form, icon_form=icon_form, logo_form=logo_form)
def _process(self): defaults = FormDefaults(self.category, meeting_theme=self.category.default_event_themes['meeting'], lecture_theme=self.category.default_event_themes['lecture']) form = CategorySettingsForm(obj=defaults, category=self.category) icon_form = CategoryIconForm(obj=self.category) logo_form = CategoryLogoForm(obj=self.category) if form.validate_on_submit(): update_category(self.category, form.data, skip={'meeting_theme', 'lecture_theme'}) self.category.default_event_themes = { 'meeting': form.meeting_theme.data, 'lecture': form.lecture_theme.data } flash(_("Category settings saved!"), 'success') return redirect(url_for('.manage_settings', self.category)) else: if self.category.icon_metadata: icon_form.icon.data = self.category if self.category.logo_metadata: logo_form.logo.data = self.category return WPCategoryManagement.render_template('management/settings.html', self.category, 'settings', form=form, icon_form=icon_form, logo_form=logo_form)