示例#1
0
 def _process(self):
     form = AdminSettingsForm(obj=FormDefaults(**settings.get_all()))
     if form.validate_on_submit():
         settings.set_multi(form.data)
         flash(_('Settings saved'), 'success')
         return redirect(url_for('.admin_settings'))
     return WPPaymentAdmin.render_template('admin_settings.html', form=form, plugins=get_payment_plugins().values())
示例#2
0
 def _process(self):
     form = AdminSettingsForm(obj=FormDefaults(**settings.get_all()))
     if form.validate_on_submit():
         settings.set_multi(form.data)
         flash(_('Settings saved'), 'success')
         return redirect(url_for('.admin_settings'))
     return WPPaymentAdmin.render_template(
         'admin_settings.html',
         form=form,
         plugins=get_payment_plugins().values())
示例#3
0
 def _process(self):
     event = self._conf
     current_event_settings = event_settings.get_all(event)
     defaults = FormDefaults(current_event_settings, **settings.get_all())
     form = EventSettingsForm(prefix='payment-', obj=defaults, event=event)
     if form.validate_on_submit():
         event_settings.set_multi(event, form.data)
         flash(_('Settings saved'), 'success')
         return redirect(url_for('.event_settings', event))
     return WPPaymentEventManagement.render_template('management/payments_edit.html', event, event=event, form=form)
示例#4
0
 def _process(self):
     event = self._conf
     current_event_settings = event_settings.get_all(event)
     defaults = FormDefaults(current_event_settings, **settings.get_all())
     form = EventSettingsForm(prefix='payment-', obj=defaults, event=event)
     if form.validate_on_submit():
         event_settings.set_multi(event, form.data)
         flash(_('Settings saved'), 'success')
         return redirect(url_for('.event_settings', event))
     return WPPaymentEventManagement.render_template(
         'event_settings_edit.html', event, event=event, form=form)
示例#5
0
 def _process(self):
     event = self._conf
     enabled = request.form['enabled'] == '1'
     if enabled and not get_payment_plugins():
         flash(_('There are no payment methods available. Please contact your Indico administrator.'), 'error')
         return redirect(url_for('.event_settings', event))
     if event_settings.get(event, 'enabled', None) is None:
         copy_settings = {'currency', 'conditions', 'register_email', 'success_email'}
         data = {k: v for k, v in settings.get_all().iteritems() if k in copy_settings}
         event_settings.set_multi(event, data)
     event_settings.set(event, 'enabled', enabled)
     return redirect(url_for('.event_settings', event))
示例#6
0
 def _process(self):
     event = self._conf
     enabled = request.form['enabled'] == '1'
     if enabled and not get_payment_plugins():
         flash(
             _('There are no payment methods available. Please contact your Indico administrator.'
               ), 'error')
         return redirect(url_for('.event_settings', event))
     if event_settings.get(event, 'enabled', None) is None:
         copy_settings = {
             'currency', 'conditions', 'register_email', 'success_email'
         }
         data = {
             k: v
             for k, v in settings.get_all().iteritems()
             if k in copy_settings
         }
         event_settings.set_multi(event, data)
     event_settings.set(event, 'enabled', enabled)
     return redirect(url_for('.event_settings', event))