def delete(id=None): form = DeleteForm() print(form.errors) if form.is_submitted(): print("submitted") print(form.errors) print('Estoy acá1') if form.validate_on_submit(): post = Post.query.get(id) if checkph(post.hash_password, form.password.data) \ or (current_user.is_authenticated and current_user.admin == 1): db.session.delete(post) db.session.commit() else: return redirect( url_for('routes.output', msg="""Contraseña errónea, bro.""")) return redirect(url_for('routes.index')) # Ahora debería guardar el catalogo del negocio en la db return render_template('user/delete.html', form=form)