Beispiel #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, form=form,
                                         definition=self.definition)
Beispiel #2
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, form=form,
                                         definition=self.definition)
Beispiel #3
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)
Beispiel #4
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)