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