-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
103 lines (67 loc) · 2.51 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
from pymysql import *
from flask import request, jsonify, render_template, Flask, redirect
from database import *
from class_invitados import *
from class_boletos import *
from class_publico import *
from class_categoria_evento import *
from class_eventos import *
from class_evento_has_publico import *
from class_suveniers import *
from class_publico_has_suveniers import *
from class_publico_has_boletos import *
Data = Database()
Data.setConnection("127.0.0.1", "root", "alumno", "web")
app = Flask(__name__)
invitado = Data.run("SELECT * FROM invitados")
listaInvitados = []
for item in invitado:
invita = invitados.cargar(item["idInvitado"])
listaInvitados.append(invita)
boleto = Data.run("SELECT * FROM boletos")
listaBoletos = []
for item in boleto:
bolet = boletos.cargar(item["idBoletos"])
listaBoletos.append(bolet)
suvenierL = Data.run("SELECT * FROM suveniers")
listaSuveniers = []
for item in suvenierL:
suvenier = suveniers.cargar(item["idSuveniers"])
listaSuveniers.append(suvenier)
eventoL = Data.run("SELECT * FROM eventos")
listaEventos = []
for item in eventoL:
evento = eventos.cargar(item["idEventos"])
listaEventos.append(eventos)
@app.route("/")
def inicio():
return render_template("index.html", listaInvitados = listaInvitados, listaBoletos = listaBoletos)
@app.route("/registro")
def registro():
return render_template("registro.html", listaBoletos = listaBoletos, listaSuveniers = listaSuveniers,
listaEventos = listaEventos)
@app.route("/registroCompleto", methods=["GET", "POST"])
def checkear():
nombre = request.form.get("nombre")
apellido = request.form.get("apellido")
email = request.form.get("email")
regalo = request.form.get("regalo")
idInsertada = publico(None, nombre, apellido, email, regalo).alta().lastrowid
for item in listaBoletos:
cantidad_boleto = request.form.get(item.dia_boleto)
publico_has_boletos(idInsertada, item.idBoletos, int(cantidad_boleto)).alta()
for item in listaSuveniers:
cantidad_suvenier = request.form.get(item.descripcion_suvenier)
publico_has_suveniers(idInsertada, item.idSuveniers, cantidad_suvenier).alta()
return redirect("/")
@app.route("/calendario")
def calendario():
return render_template("calendario.html")
@app.route("/admin")
def admin():
return render_template()
@app.route("/admin=post", methods=["GET", "POST"])
def adminPost():
return render_template()
if __name__ == "__main__":
app.run(debug=True)