Пример #1
0
 def _edit(self):
     accomodation = Accomodation.get(self.request.params.get('id'))
     form = AccomodationForm(self.request)
     if form.validate():
         form.submit(accomodation)
         return {
             'success_message': _(u'Saved'),
             'response': accomodation.id,
         }
     else:
         return {
             'error_message': _(u'Please, check errors'),
             'errors': form.errors
         }
Пример #2
0
 def _edit(self):
     accomodation = Accomodation.get(self.request.params.get('id'))
     form = AccomodationForm(self.request)
     if form.validate():
         form.submit(accomodation)
         return {
             'success_message': _(u'Saved'),
             'response': accomodation.id,
         }
     else:
         return {
             'error_message': _(u'Please, check errors'),
             'errors': form.errors
         }
Пример #3
0
 def _add(self):
     form = AccomodationForm(self.request)
     if form.validate():
         accomodation = form.submit()
         DBSession.add(accomodation)
         DBSession.flush()
         return {
             'success_message': _(u'Saved'),
             'response': accomodation.id
         }
     else:
         return {
             'error_message': _(u'Please, check errors'),
             'errors': form.errors
         }
Пример #4
0
 def _add(self):
     form = AccomodationForm(self.request)
     if form.validate():
         accomodation = form.submit()
         DBSession.add(accomodation)
         DBSession.flush()
         return {
             'success_message': _(u'Saved'),
             'response': accomodation.id
         }
     else:
         return {
             'error_message': _(u'Please, check errors'),
             'errors': form.errors
         }