haldis/app/create_database.py

65 lines
2 KiB
Python
Raw Normal View History

2015-03-26 21:49:14 +01:00
from models import *
from app import db
2015-03-30 18:50:39 +02:00
from itertools import product
2015-03-26 21:49:14 +01:00
db.drop_all()
db.create_all()
feli = User()
2015-03-26 22:23:11 +01:00
feli.configure("feliciaan", True, 0)
2015-03-26 21:49:14 +01:00
db.session.add(feli)
2015-03-27 14:03:28 +01:00
destro = User()
destro.configure('destro', True, 0)
db.session.add(destro)
2015-03-26 21:49:14 +01:00
2015-03-31 12:18:00 +02:00
iepoev = User()
iepoev.configure('iepoev', True, 1)
db.session.add(iepoev)
2015-03-31 12:18:00 +02:00
burrito = Location()
burrito.configure("Burrito Bar", "Top-4-straat Keknet-city", "burritofest.com")
db.session.add(burrito)
blauw_kotje = Location()
blauw_kotje.configure("'t Blauw Kotje", "Top-5-straat Keknet-city", "frietfest.com")
db.session.add(blauw_kotje)
chili_con_carne = Product()
chili_con_carne.configure(burrito, "Chili Con Carne", 550)
db.session.add(chili_con_carne)
medium_pak_frieten = Product()
medium_pak_frieten.configure(blauw_kotje, "Medium Pak Frieten", 220)
db.session.add(medium_pak_frieten)
2015-03-26 21:49:14 +01:00
# To future developers, add yourself here
2015-03-30 18:30:01 +02:00
############################################
# Chinees autogenerate #
############################################
2015-03-30 18:50:39 +02:00
zetmelen = ["Nasi", "Bami"]
2015-03-30 18:30:01 +02:00
vlezen = ["Rundsvlees", "Varkensvlees"]
sauzen = ["Balisaus", "Yu siang saus", "Gon boa saus", "Curry saus", "Oestersaus", "Zwarte pepersaus",
"Champignons", "Chinese champignons", "A la Maleisïe"]
specials = ["Kippenbolletjes zoetzuur", "varkenbolletjes zoetzuur", "Nazi Babi Pangang", "Bami Babi Pangang",
"Diverse groenten met bami(Vegetarisch)", "Diverse groenten met nazi(Vegetarisch)"]
chinees = Location()
2015-03-30 18:50:39 +02:00
chinees.configure("Oceans's Garden", "Top-4-straat Keknet-city", "http://oceangarden.byethost3.com/studentenmenus.html")
2015-03-30 23:02:05 +02:00
db.session.add(chinees)
2015-03-30 18:30:01 +02:00
2015-03-30 18:50:39 +02:00
def chinees_create_entry(zetmeel, vlees="", saus=""):
2015-03-30 18:30:01 +02:00
entry = Product()
entry.configure(chinees, "{} {} {}".format(zetmeel, vlees, saus).rstrip(), 550)
db.session.add(entry)
2015-03-30 18:50:39 +02:00
for zetmeel, vlees, saus in product(zetmelen, vlezen, sauzen):
chinees_create_entry(zetmeel, vlees, saus)
2015-03-30 18:30:01 +02:00
for special in specials:
2015-03-30 18:50:39 +02:00
chinees_create_entry(special)
2015-03-30 18:30:01 +02:00
#############################################
2015-03-26 21:49:14 +01:00
# commit all the things
db.session.commit()