Author: chrisz
Date: Wed Dec 22 07:36:15 2010
New Revision: 7197
URL: http://trac.turbogears.org/changeset/7197

Log:
Improved the quickstart template for Elixir.

Modified:
   branches/1.1/turbogears/qstemplates/quickstart/+package+/model.py_tmpl
   branches/1.5/turbogears/qstemplates/quickstart/+package+/model.py_tmpl

Modified: branches/1.1/turbogears/qstemplates/quickstart/+package+/model.py_tmpl
==============================================================================
--- branches/1.1/turbogears/qstemplates/quickstart/+package+/model.py_tmpl      
Tue Dec 21 14:35:27 2010        (r7196)
+++ branches/1.1/turbogears/qstemplates/quickstart/+package+/model.py_tmpl      
Wed Dec 22 07:36:15 2010        (r7197)
@@ -69,7 +69,7 @@
 #end if
 #if $sqlalchemy == 'True'
 #if $elixir == 'True'
-options_defaults['autosetup'] = False
+options_defaults.update(autosetup=False, metadata=metadata, session=session)
 
 
 # your data model
@@ -367,11 +367,6 @@
         """Look up Permission by given permission name."""
         return cls.get_by(permission_name=permission_name)
     by_name = by_permission_name
-
-
-# Set up all Elixir entities declared above
-
-setup_all()
 #else
 # the identity schema
 
@@ -550,6 +545,12 @@
 #end if
 #end if
 
+#if $elixir == 'True'
+# set up all Elixir entities declared above
+
+setup_all()
+#end if
+
 # functions for populating the database
 
 #if $identity == 'none'
@@ -642,9 +643,16 @@
     get_engine()
     if drop_all:
         print "Dropping all database tables defined in model."
+#if $elixir == 'True'
+        from elixir import drop_all
+        drop_all()
+    from elixir import create_all
+    create_all()
+#else
         metadata.drop_all()
     metadata.create_all()
 #end if
+#end if
 
     print "All database tables defined in model created."
 

Modified: branches/1.5/turbogears/qstemplates/quickstart/+package+/model.py_tmpl
==============================================================================
--- branches/1.5/turbogears/qstemplates/quickstart/+package+/model.py_tmpl      
Tue Dec 21 14:35:27 2010        (r7196)
+++ branches/1.5/turbogears/qstemplates/quickstart/+package+/model.py_tmpl      
Wed Dec 22 07:36:15 2010        (r7197)
@@ -69,7 +69,7 @@
 #end if
 #if $sqlalchemy == 'True'
 #if $elixir == 'True'
-options_defaults['autosetup'] = False
+options_defaults.update(autosetup=False, metadata=metadata, session=session)
 
 
 # your data model
@@ -367,11 +367,6 @@
         """Look up Permission by given permission name."""
         return cls.get_by(permission_name=permission_name)
     by_name = by_permission_name
-
-
-# Set up all Elixir entities declared above
-
-setup_all()
 #else
 # the identity schema
 
@@ -550,6 +545,12 @@
 #end if
 #end if
 
+#if $elixir == 'True'
+# set up all Elixir entities declared above
+
+setup_all()
+#end if
+
 # functions for populating the database
 
 #if $identity == 'none'
@@ -642,9 +643,16 @@
     get_engine()
     if drop_all:
         print "Dropping all database tables defined in model."
+#if $elixir == 'True'
+        from elixir import drop_all
+        drop_all()
+    from elixir import create_all
+    create_all()
+#else
         metadata.drop_all()
     metadata.create_all()
 #end if
+#end if
 
     print "All database tables defined in model created."
 

Reply via email to