Esempio n. 1
0
import web
# @
from web import form
from datos import Clientes
from datos import Peliculas
render = web.template.render('templates')
urls = ('/(.*)', 'index')

db = web.database(dbn='mysql', db='peliculas', user='******', pw='utec')

Clientes = Clientes()
Clientes.read()
Peliculas = Peliculas()
Peliculas.read()
myform = form.Form(form.Dropdown('Cliente', Clientes.getClientes()),
                   form.Dropdown('Pelicula', Peliculas.getPeliculas()),
                   form.Dropdown('Formato', ["Blueray", "DVD"]),
                   form.Textbox('Tiempo'))


class index:
    def GET(self, results):
        form = myform()
        resultado = db.select('peliculas')
        return render.index(form, resultado)

    def POST(self, results):
        form = myform()
        if not form.validates():
            return render.index(form)
        else:
Esempio n. 2
0
import web
from web import form
from datos import Clientes
from datos import Peliculas

render = web.template.render('templates')

urls = ('/(.*)', 'index')
db = web.database(
    dbn='mysql',
    db='y36mdrhx01a3r6mx',
    user='******',
    pw='rvkzljd0ckntnc3w',
    host='o61qijqeuqnj9chh.cbetxkdyhwsb.us-east-1.rds.amazonaws.com')
Clientes = Clientes()
Clientes.read()
peliculas = Peliculas()
peliculas.read()

myform = form.Form(
    form.Dropdown('Cliente', Clientes.getClientes()),
    form.Dropdown('Pelicula', peliculas.getPeliculas()),
    form.Dropdown('Formato', ["Blueray", "DVD"]),
    form.Dropdown('Tiempo', ["1", "2", "3", "4", "5", "6", "7"]))


class index:
    def GET(self, results):
        form = myform()
        registros = db.select('renta')
        return render.index(form, registros)