Esempio n. 1
0
 def _edit(self):
     appointment = Appointment.get(self.request.params.get('id'))
     form = AppointmentForm(self.request)
     if form.validate():
         form.submit(appointment)
         return {'success_message': _(u'Saved'), 'response': appointment.id}
     else:
         return {
             'error_message': _(u'Please, check errors'),
             'errors': form.errors
         }
Esempio n. 2
0
 def _add(self):
     form = AppointmentForm(self.request)
     if form.validate():
         appointment = form.submit()
         DBSession.add(appointment)
         DBSession.flush()
         return {'success_message': _(u'Saved'), 'response': appointment.id}
     else:
         return {
             'error_message': _(u'Please, check errors'),
             'errors': form.errors
         }
Esempio n. 3
0
 def _edit(self):
     appointment = Appointment.get(self.request.params.get('id'))
     form = AppointmentForm(self.request)
     if form.validate():
         form.submit(appointment)
         return {
             'success_message': _(u'Saved'),
             'response': appointment.id
         }
     else:
         return {
             'error_message': _(u'Please, check errors'),
             'errors': form.errors
         }
Esempio n. 4
0
 def _add(self):
     form = AppointmentForm(self.request)
     if form.validate():
         appointment = form.submit()
         DBSession.add(appointment)
         DBSession.flush()
         return {
             'success_message': _(u'Saved'),
             'response': appointment.id
         }
     else:
         return {
             'error_message': _(u'Please, check errors'),
             'errors': form.errors
         }