def index(): if request.method == "POST": c_nombre = request.form['nombre'] c_apellido = request.form['apellido'] alumno = Alumnos(nombre=c_nombre, apellido=c_apellido) db.session.add(alumno) db.session.commit() alumnos = call_pacientes() return render_template("nuevo.html", nombre=c_nombre, l_alumnos=alumnos) lista = ["Acerca", "Contacto", "Nosotros", "FAQ"] return render_template("about.html", lista=lista)
def login(): error = None if request.method == 'POST': if request.form['username'] != app.config['USERNAME']: error = 'Invalid username' elif request.form['password'] != app.config['PASSWORD']: error = 'Invalid password' else: session['logged_in'] = True flash('You were logged in') return redirect(url_for('show_entries')) return render_template('login.html', error=error)
def login(): error = None if request.method == 'POST': if request.form['username'] != app.config['USERNAME']: error = 'Invalid username' elif request.form['password'] != app.config['PASSWORD']: error = 'Invalid password' else: session['logged_in'] = True flash('You were logged in') return redirect(url_for('show_entries')) return render_template('login.html', error=error)
def searchLabel(label_id, page, label_name): label_articals = ArticalLabel.query.filter_by(label_id=label_id).all() articals_id = [] for label_artical in label_articals: articals_id.append(int(label_artical.artical_id)) articals = Artical.query.filter(Artical.id.in_(articals_id)).order_by( db.desc(Artical.id)).offset((page - 1) * 8).limit(8) return render_template("search.html", articals=articals, page=page, label_id=label_id, theme=label_name)
def artical(id): content = ArticalContent.query.get(id) artical = Artical.query.get(id) label_ids = ArticalLabel.query.filter_by(artical_id=id) labels = [] for label_id in label_ids: label = Label.query.get(int(label_id.label_id)) labels.append(label) messages = Message.query.filter_by(artical_id=id).all() return render_template("artical.html", theme=artical.title, artical=content, time=artical.time, labels=labels, messages=messages)
def backstage(): labels = Label.query.all() return render_template("backstage.html", theme="Backstage", labels=labels)
def show_entries(): db = get_db() cur = db.execute('select title, text from entries order by id desc') entries = cur.fetchall() return render_template('show_entries.html', entries=entries)
def show_entries(): db = get_db() cur = db.execute('select title, text from entries order by id desc') entries = cur.fetchall() return render_template('show_entries.html', entries=entries)
def serverError(e): return render_template("error/500.html", theme="500"), 500
def pageNotFound(e): return render_template("error/404.html", theme="404"), 404
def listar(): alumnos = call_pacientes() return render_template("nuevo.html", l_alumnos=alumnos)
def modificar(id): alumno = Alumnos.query.filter(Alumnos.id == id).first() return render_template("editar.html", alumno=alumno)
def nuevo(): return render_template("nuevo.html")
def hola(nombre=None): return render_template("index.html", mensaje=nombre)
def note(page): articals = Artical.query.order_by(db.desc(Artical.id)).offset((page-1)*8).limit(8) return render_template("note.html", theme="Note", articals=articals, page=page)