def _process(self): form = self.agent.backend.form(obj=FormDefaults(self.agent, {'name'}, **self.agent.settings)) if form.validate_on_submit(): data = form.data self.agent.name = data.pop('name') self.agent.settings = data flash(_('Agent updated'), 'success') return redirect(url_for('plugins.details', plugin='livesync')) return WPLiveSync.render_template('edit_agent.html', form=form, backend=self.agent.backend, agent=self.agent)
def _process(self): form = self.backend.form(obj=FormDefaults(name=self.backend.title)) if form.validate_on_submit(): data = form.data name = data.pop('name') agent = LiveSyncAgent(name=name, backend_name=self.backend_name, settings=data) db.session.add(agent) flash(_('Agent added'), 'success') flash(_("Don't forget to run the initial export!"), 'highlight') return redirect(url_for('plugins.details', plugin='livesync')) return WPLiveSync.render_template('edit_agent.html', form=form, backend=self.backend)
def _process(self): form = self.agent.backend.form( obj=FormDefaults(self.agent, {'name'}, **self.agent.settings)) if form.validate_on_submit(): data = form.data self.agent.name = data.pop('name') self.agent.settings = data flash(_('Agent updated'), 'success') return redirect(url_for('plugins.details', plugin='livesync')) return WPLiveSync.render_template('edit_agent.html', form=form, backend=self.agent.backend, agent=self.agent)