Example #1
0
def addParking():
    piano = request.args.get('level')
    for i in range(1, 41):
        parking = Parking()
        parking.piano = piano
        parking.number = i
        parking.put()
    return "Parcheggi piano " + str(piano) + " inseriti."
Example #2
0
def add_data():
    if request.method == 'GET':
        #utente
        usr = User()
        usr.nome = "Luca"
        usr.cognome = "Puggioninu"
        usr.uuid = str(uuid.uuid4())
        usr.password = hashlib.sha1("ciaone").hexdigest()
        usr.email = "*****@*****.**"
        usr.targa = "GF6543"
        usr.tariffa = "Tariffa 1"
        usr.is_valid = True
        usr.put()

        #admin
        usr = User()
        usr.nome = "Claudio"
        usr.cognome = "Marche"
        usr.uuid = str(uuid.uuid4())
        usr.password = hashlib.sha1("ciaone").hexdigest()
        usr.email = "*****@*****.**"
        usr.tariffa = "Tariffa 1"
        usr.targa = "GF6543"
        usr.is_valid = True
        usr.has_superuser = True
        usr.put()

        #tariffa
        tar = Tariffa()
        tar.tariffa = 'Tariffa 1'
        tar.description = "La piu' bella gazz"
        tar.prezzo = 5.00
        tar.order = 1
        tar.visibilita = True
        tar.put()

        tar = Tariffa()
        tar.tariffa = 'Tariffa 2'
        tar.description = "La meno bella gazz"
        tar.order = 2
        tar.prezzo = 5.00
        tar.visibilita = False
        tar.put()

        #parcheggi
        state = ['Libero', 'Prenotato', 'Occupato', 'Fuori Servizio']
        for piano in ['A', 'B', 'C', 'D']:
            for i in range(1, 41):
                parking = Parking()
                parking.piano = piano
                parking.number = i
                parking.stato = state[randint(0, 3)]
                parking.put()
        flash("Dati Aggiunti")
        return redirect(url_for('auth.login'))