Exemple #1
0
 def setUp(self):
     self.config = testing.setUp()
     from sqlalchemy import create_engine
     engine = create_engine('sqlite://')
     from feedduty.models import (
         BaseModel,
         MyModel,
         )
     DBSession.configure(bind=engine)
     BaseModel.metadata.create_all(engine)
     with transaction.manager:
         model = MyModel(name='one', value=55)
         DBSession.add(model)
Exemple #2
0
 def setUp(self):
     self.config = testing.setUp()
     from sqlalchemy import create_engine
     engine = create_engine('sqlite://')
     from feedduty.models import (
         BaseModel,
         MyModel,
     )
     DBSession.configure(bind=engine)
     BaseModel.metadata.create_all(engine)
     with transaction.manager:
         model = MyModel(name='one', value=55)
         DBSession.add(model)
Exemple #3
0
    def collection_post(self):
        """
        Create new object - Only accepts POST requests on the collection URI
        """
        form = self.form(self.request.POST)
        obj = self.model()

        if form.validate():
            # extract values from form and populate the feed instance
            form.populate_obj(obj)

            # Save the feed to the database
            DBSession.add(obj)

            resp = {'success': True, 'result': obj}
        else:
            resp = {'success': False, 'errors': {}}

        return resp