Add a Home document to the seeded entities
authorSverre Rabbelier <srabbelier@gmail.com>
Sun, 15 Feb 2009 20:25:10 +0000
changeset 1355 7a00bcfa0371
parent 1354 aba2beea6dfa
child 1356 32d8d83678cd
Add a Home document to the seeded entities Patch by: Sverre Rabbelier
app/soc/models/seed_db.py
--- a/app/soc/models/seed_db.py	Sun Feb 15 18:56:35 2009 +0000
+++ b/app/soc/models/seed_db.py	Sun Feb 15 20:25:10 2009 +0000
@@ -28,23 +28,34 @@
 from google.appengine.api import users
 from google.appengine.ext import db
 
-from soc.models.site import Site
-from soc.models.user import User
-from soc.models.sponsor import Sponsor
+from soc.models.document import Document
 from soc.models.host import Host
-from soc.models.program import Program
-from soc.models.timeline import Timeline
-from soc.models.org_app import OrgApplication
-from soc.models.organization import Organization
-from soc.models.org_admin import OrgAdmin
 from soc.models.mentor import Mentor
 from soc.models.notification import Notification
+from soc.models.org_admin import OrgAdmin
+from soc.models.organization import Organization
+from soc.models.org_app import OrgApplication
+from soc.models.program import Program
+from soc.models.site import Site
+from soc.models.sponsor import Sponsor
+from soc.models.timeline import Timeline
+from soc.models.user import User
 
 
 def seed(*args, **kwargs):
   """Seeds the datastore with some default values.
   """
 
+
+  site_properties = {
+      'key_name': 'site',
+      'link_id': 'site',
+      }
+
+  site = Site(**site_properties)
+  site.put()
+
+
   account = users.get_current_user()
 
   if not account:
@@ -54,7 +65,6 @@
         'key_name': 'test',
         'link_id': 'test',
         'account': account,
-        'agreed_to_tos': True,
         'name': 'Test',
         }
 
@@ -194,6 +204,27 @@
   melange_mentor = Mentor(**role_properties)
   melange_mentor.put()
 
+
+  document_properties = {
+      'key_name': 'site/site/home',
+      'link_id': 'home',
+      'scope_path': 'site',
+      'scope': site,
+      'prefix': 'site',
+      'author': current_user,
+      'title': 'Home Page',
+      'short_name': 'Home',
+      'content': 'This is the Home Page',
+      'modified_by': current_user,
+      }
+
+  home_document = Document(**document_properties)
+  home_document.put()
+
+
+  site.home = home_document
+  site.put()
+
   return
 
 
@@ -213,6 +244,7 @@
       Sponsor.all(),
       User.all(),
       Site.all(),
+      Document.all(),
       ])
 
   for entity in entities: