836835746d9f80c9bacf348c3d28eaee9637caff
[zzz-floof.git] / floof / model / __init__.py
1 """The application's model objects"""
2 import elixir
3 from floof.model import meta
4
5 Session = elixir.session = meta.Session
6 # Uncomment if using reflected tables
7 # elixir.options_defaults.update({'autoload': True})
8 elixir.options_defaults.update({'shortnames':True})
9 metadata = elixir.metadata
10
11 # this will be called in config/environment.py
12 # if not using reflected tables
13 def init_model(engine):
14 """Call me before using any of the tables or classes in the model"""
15 meta.Session.configure(bind=engine)
16 metadata.bind = engine
17
18 # Delay the setup if using reflected tables
19 if elixir.options_defaults.get('autoload', False) \
20 and not metadata.is_bound():
21 elixir.delay_setup = True
22
23 # # import other entities here, e.g.
24 # from floof.model.blog import BlogEntry, BlogComment
25 from floof.model.art import *
26 from floof.model.ratings import *
27 from floof.model.comments import *
28 from floof.model.search import *
29 from floof.model.tags import *
30 from floof.model.users import *
31 from floof.model.relations import *
32
33
34 # Finally, call elixir to set up the tables.
35 # but not if using reflected tables
36 if not elixir.options_defaults.get('autoload', False):
37 elixir.setup_all()
38
39