Package restructure and small create_database changes

This commit is contained in:
Wout Schellaert 2015-05-13 13:34:32 +02:00
parent 69590c460e
commit 111944619f
5 changed files with 6 additions and 6 deletions

View file

@ -3,9 +3,6 @@ from models import User
def add(): def add():
db.drop_all()
db.create_all()
feli = User() feli = User()
feli.configure("feliciaan", True, 0) feli.configure("feliciaan", True, 0)
db.session.add(feli) db.session.add(feli)

View file

@ -1,5 +1,5 @@
from app import db from app import db
from database import add_oceans_garden, add_admins, add_simpizza import add_oceans_garden, add_admins, add_simpizza
entry_sets = {"Admins": add_admins.add, "Ocean's Garden": add_oceans_garden.add, "SimPizza": add_simpizza.add} entry_sets = {"Admins": add_admins.add, "Ocean's Garden": add_oceans_garden.add, "SimPizza": add_simpizza.add}
@ -28,8 +28,10 @@ def recreate_from_scratch():
confirmation = "Are you very very sure? (Will delete previous entry's!) (y/N) " confirmation = "Are you very very sure? (Will delete previous entry's!) (y/N) "
check = "I acknowledge any repercussions!" check = "I acknowledge any repercussions!"
if input(confirmation) in yes and input("Type: '{}' ".format(check)) == check: if input(confirmation) in yes and input("Type: '{}' ".format(check)) == check:
print("Overwriting the database!") print("Resetting the database!")
add_all() db.drop_all()
db.create_all()
add_to_current()
def add_to_current(): def add_to_current():
@ -43,6 +45,7 @@ def add_to_current():
answer = input("Available: {} : ".format(add_numbers())) answer = input("Available: {} : ".format(add_numbers()))
if answer == "A": if answer == "A":
add_all() add_all()
available = []
elif answer == "C": elif answer == "C":
pass pass
elif answer in [str(x) for x in range(len(available))]: elif answer in [str(x) for x in range(len(available))]: