diff options
Diffstat (limited to 'jm2l/scripts/initializedb.py')
-rw-r--r-- | jm2l/scripts/initializedb.py | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/jm2l/scripts/initializedb.py b/jm2l/scripts/initializedb.py index 5223b94..38776dd 100644 --- a/jm2l/scripts/initializedb.py +++ b/jm2l/scripts/initializedb.py @@ -4,7 +4,7 @@ import sys import transaction import time import lxml.etree as ET -from datetime import datetime + from sqlalchemy import engine_from_config from sqlalchemy import create_engine import unicodedata @@ -13,14 +13,13 @@ import urllib from slugify import slugify from sqlite3 import dbapi2 as sqlite from os import path - from pyramid.paster import ( get_appsettings, setup_logging, ) - from jm2l.models import * +from datetime import datetime def usage(argv): cmd = os.path.basename(argv[0]) @@ -39,5 +38,30 @@ def main(argv=sys.argv): DBSession.configure(bind=engine) Base.metadata.create_all(engine) with transaction.manager: - admin = User(nom=u'jm2l', prenom='contact', slug='contact jm2l', password=u'jm2l', mail=u'contact@jm2l.linux-azur.org') - DBSession.add(admin)
\ No newline at end of file + admin = User(nom=u'jm2l', prenom='contact', + slug='contact jm2l', password=u'jm2l', + mail=u'contact@jm2l.linux-azur.org', + Staff=1 + ) + DBSession.add(admin) + + # Create 2015 year event + jm2l = JM2L_Year(year_uid=2015, + state="Ongoing", + description=u"%d, %dème édition des JM2L." % ( 2015, 9 ), + start_time=datetime.strptime("28-11-2015 10:00","%d-%m-%Y %H:%M"), + end_time=datetime.strptime("28-11-2015 19:00","%d-%m-%Y %H:%M") + ) + DBSession.add(jm2l) + + # Create 2015 Physic room event + phy_salle = SallePhy( name=u"Polytech salle 211", + description=u"Salle informatique, présence de postes de travail",) + DBSession.add(phy_salle) + DBSession.flush() + + # Create matching room place (Name could change each year) + salle = Salles(name=u"Mystère", description=u"Salle Mystère", + phy_salle_id = phy_salle.uid, + year_uid = jm2l.year_uid) + DBSession.add(salle)
\ No newline at end of file |