示例#1
0
 def setup_model():
     from sqlalchemy.orm import configure_mappers
     from camelot.core.sql import metadata
     metadata.bind = settings.ENGINE()
     import camelot.model.party
     import camelot.model.authentication
     import camelot.model.i18n
     import camelot.model.fixture
     import camelot.model.memento
     import camelot.model.batch_job
     import camelot_example.model
     #
     # create the tables for all models, configure mappers first, to make
     # sure all deferred properties have been handled, as those could
     # create tables or columns
     #
     configure_mappers()
     metadata.create_all()
     from camelot.model.authentication import update_last_login
     #update_last_login()
     # 
     # Load sample data with the fixure mechanism
     #
     from camelot_example.fixtures import load_movie_fixtures
     load_movie_fixtures()
     #
     # setup the views
     #
     from camelot_example.view import setup_views
     setup_views()
示例#2
0
文件: main.py 项目: Governa/Camelot
 def setup_model():
     from sqlalchemy.orm import configure_mappers
     from camelot.core.sql import metadata
     metadata.bind = settings.ENGINE()
     import camelot.model.party
     import camelot.model.authentication
     import camelot.model.i18n
     import camelot.model.fixture
     import camelot.model.memento
     import camelot_example.model
     #
     # setup_all is only needed for those models that rely on elixir
     #
     from elixir import setup_all
     setup_all()
     #
     # create the tables for all models, configure mappers first, to make
     # sure all deferred properties have been handled, as those could
     # create tables or columns
     #
     configure_mappers()
     metadata.create_all()
     from camelot.model.authentication import update_last_login
     update_last_login()
     # 
     # Load sample data with the fixure mechanism
     #
     from camelot_example.fixtures import load_movie_fixtures
     load_movie_fixtures()
     #
     # setup the views
     #
     from camelot_example.view import setup_views
     setup_views()
示例#3
0
 def setup_model():
     from sqlalchemy.orm import configure_mappers
     from camelot.core.sql import metadata
     metadata.bind = settings.ENGINE()
     #
     # import all the needed model files to make sure the mappers and tables
     # are defined before creating them in the database
     #
     from camelot.model import (party, authentication, i18n, fixture,
                                memento, batch_job)
     from . import model
     logger.debug('loaded datamodel for %s'%party.__name__)
     logger.debug('loaded datamodel for %s'%authentication.__name__)
     logger.debug('loaded datamodel for %s'%i18n.__name__)
     logger.debug('loaded datamodel for %s'%fixture.__name__)
     logger.debug('loaded datamodel for %s'%memento.__name__)
     logger.debug('loaded datamodel for %s'%batch_job.__name__)
     logger.debug('loaded datamodel for %s'%model.__name__)
     #
     # create the tables for all models, configure mappers first, to make
     # sure all deferred properties have been handled, as those could
     # create tables or columns
     #
     configure_mappers()
     metadata.create_all()
     # 
     # Load sample data with the fixure mechanism
     #
     from camelot_example.fixtures import load_movie_fixtures
     load_movie_fixtures()
     #
     # setup the views
     #
     from camelot_example.view import setup_views
     setup_views()
示例#4
0
 def setUp(self):
     super( QueryProxyCase, self ).setUp()
     from camelot_example.fixtures import load_movie_fixtures
     from camelot.model.party import Person
     from camelot.view.proxy.queryproxy import QueryTableProxy
     from camelot.admin.application_admin import ApplicationAdmin
     load_movie_fixtures()
     self.app_admin = ApplicationAdmin()
     self.person_admin = self.app_admin.get_related_admin( Person )
     Person.query.count
     self.person_proxy = QueryTableProxy( self.person_admin, 
                                          query_getter = lambda:Person.query, 
                                          columns_getter = self.person_admin.get_columns )
示例#5
0
def setup_model():
    from camelot.core.sql import metadata
    metadata.bind = ENGINE()
    from camelot.model import authentication
    from camelot.model import party
    from camelot.model import i18n
    from camelot.model import memento
    from camelot.model import fixture
    from camelot.model import batch_job
    import camelot_example.model
    from camelot_example.view import setup_views
    from camelot_example.fixtures import load_movie_fixtures
    from elixir import setup_all
    from camelot.model.authentication import update_last_login
    setup_all(create_tables=True)
    setup_views()
    load_movie_fixtures()
    update_last_login()
示例#6
0
    def setup_model(self):
        from camelot.core.sql import metadata
        metadata.bind = self.ENGINE()
        from camelot.model import authentication
        from camelot.model import party
        from camelot.model import i18n
        from camelot.model import memento
        from camelot.model import fixture
        from camelot.model import batch_job
        import camelot_example.model

        from camelot_example.view import setup_views
        from camelot_example.fixtures import load_movie_fixtures
        from camelot.model.authentication import update_last_login
        from camelot.core.orm import setup_all
        setup_all(create_tables=True)
        setup_views()
        load_movie_fixtures()
        update_last_login()
示例#7
0
    def setup_model( self ):
        from camelot.core.sql import metadata
        # bind metadata to a specific connection, when using the in memory
        # database this is needed or the data is lost
        metadata.bind = self.ENGINE().connect()
        from camelot.model import authentication
        from camelot.model import party
        from camelot.model import i18n
        from camelot.model import memento
        from camelot.model import fixture
        from camelot.model import batch_job
        import camelot_example.model

        from camelot_example.view import setup_views
        from camelot_example.fixtures import load_movie_fixtures
        from camelot.model.authentication import update_last_login
        from camelot.core.orm import setup_all
        setup_all(create_tables=True)
        setup_views()
        load_movie_fixtures()
        update_last_login()
示例#8
0
 def setUp(self):
     super(ProxyCase, self).setUp()
     load_movie_fixtures()
     self.app_admin = ApplicationAdmin()
     self.person_admin = self.app_admin.get_related_admin(Person)
示例#9
0
 def setUp( self ):
     super( ProxyCase, self ).setUp()
     load_movie_fixtures()
     self.app_admin = ApplicationAdmin()
     self.person_admin = self.app_admin.get_related_admin( Person )