示例#1
0
 def _process(self):
     form = SubContributionForm(event=self.event)
     if form.validate_on_submit():
         subcontrib = create_subcontribution(self.contrib, form.data)
         flash(_("Subcontribution '{}' created successfully").format(subcontrib.title), 'success')
         return jsonify_data(html=_render_subcontribution_list(self.contrib))
     return jsonify_template('events/contributions/forms/subcontribution.html', form=form)
示例#2
0
 def _process_POST(self):
     form = SubContributionForm(event=self.event)
     if form.validate_on_submit():
         subcontrib = create_subcontribution(self.contrib, form.data)
         return jsonify(id=subcontrib.id,
                        contribution_id=subcontrib.contribution_id,
                        event_id=self.event.id)
     return jsonify_data(success=False, errors=form.errors), 400
示例#3
0
文件: management.py 项目: fph/indico
 def _process(self):
     form = SubContributionForm(obj=FormDefaults(self.subcontrib), event=self.event_new, subcontrib=self.subcontrib)
     if form.validate_on_submit():
         update_subcontribution(self.subcontrib, form.data)
         flash(_("Subcontribution '{}' updated successfully").format(self.subcontrib.title), 'success')
         return jsonify_data(html=_render_subcontribution_list(self.contrib))
     self.commit = False
     return jsonify_template('events/contributions/forms/subcontribution.html', form=form)
示例#4
0
 def _process(self):
     form = SubContributionForm(obj=FormDefaults(self.subcontrib), event=self.event, subcontrib=self.subcontrib)
     if form.validate_on_submit():
         update_subcontribution(self.subcontrib, form.data)
         flash(_("Subcontribution '{}' updated successfully").format(self.subcontrib.title), 'success')
         return jsonify_data(html=_render_subcontribution_list(self.contrib))
     elif not form.is_submitted():
         handle_legacy_description(form.description, self.subcontrib)
     self.commit = False
     return jsonify_template('events/contributions/forms/subcontribution.html', form=form)
示例#5
0
 def _process_POST(self):
     form = SubContributionForm(event=self.event)
     if form.validate_on_submit():
         subcontrib = create_subcontribution(self.contrib, form.data)
         return jsonify(id=subcontrib.id, contribution_id=subcontrib.contribution_id, event_id=self.event.id)
     return jsonify_data(success=False, errors=form.errors), 400