Example #1
0
 def delete(self, genero_id):
     errores = []
     errores.append("Se elimino el genero correctamente")
     genero = Genero.eliminar(genero_id)
     generos = Genero.all()
     return render_template('generos/index.html',
                            generos=generos,
                            errores=errores)
Example #2
0
 def catalogo_todos(self, libros):
     autores = Author.all()
     generos = Genero.all()
     editoriales = Editorial.all()
     return render_template('libros/catalogo.html',
                            libros=libros,
                            autores=autores,
                            generos=generos,
                            editoriales=editoriales)
Example #3
0
 def new(self, errores=[], old={}):
     editoriales = Editorial.all()
     generos = Genero.all()
     autores = Author.all_active()
     return render_template('libros/agregar.html',
                            editoriales=editoriales,
                            generos=generos,
                            autores=autores,
                            errores=errores,
                            old=old)
Example #4
0
 def edit(self, libro_id, errores=[]):
     libro = Libro.id(libro_id)
     editoriales = Editorial.all()
     generos = Genero.all()
     autores = Author.all_active()
     return render_template('libros/editar.html',
                            libro=libro,
                            editoriales=editoriales,
                            generos=generos,
                            autores=autores,
                            errores=errores)
Example #5
0
    def index(self, perfil_id=None):
        if perfil_id != None:
            try:
                int(perfil_id)
                session["perfil_id"] = perfil_id
            except:
                pass
        libros = Libro.all()
        editoriales = Editorial.all()
        generos = Genero.all()
        autores = Author.all()
        cant = 0
        mostrar = []
        for libro in libros:
            if cant < 6:
                mostrar.append(libro)
            cant = cant + 1

        return render_template('index.html',
                               libros=mostrar,
                               editoriales=editoriales,
                               generos=generos,
                               autores=autores)
Example #6
0
 def index(self):
     generos = Genero.all()
     return render_template('generos/index.html', generos=generos)