Ejemplo n.º 1
0
 def _process(self):
     form = self._get_form()
     if form.validate_on_submit():
         self._success_handler(form)
         return jsonify(success=True)
     return WPJinjaMixin.render_template(self.dialog_template,
                                         event=self.event_new,
                                         form=form,
                                         definition=self.definition)
Ejemplo n.º 2
0
 def _process(self):
     agreement = self.agreement
     form = AgreementAnswerSubmissionForm()
     if form.validate_on_submit():
         if agreement is None:
             agreement = Agreement.create_from_data(event=self.event, type_=self.definition.name,
                                                    person=self.person)
             db.session.add(agreement)
             db.session.flush()
         if form.answer.data:
             agreement.accept(from_ip=request.remote_addr, on_behalf=True)
             agreement.attachment_filename = form.document.data.filename
             agreement.attachment = form.document.data.read()
         else:
             agreement.reject(from_ip=request.remote_addr, on_behalf=True)
         flash(_("Agreement answered on behalf of {0}".format(agreement.person_name)), 'success')
         return jsonify(success=True)
     return WPJinjaMixin.render_template('events/agreements/dialogs/agreement_submit_answer_form.html', form=form,
                                         event=self.event, agreement=agreement)