Exemplo 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
         }
Exemplo 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
         }
Exemplo 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
         }
Exemplo 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
         }