Commit bca53f25 authored by Alex's avatar Alex
Browse files

remove entities route

parent 6e4d3f65
Pipeline #211014 canceled with stages
in 5 seconds
from flask import Blueprint, render_template
from flask import Blueprint, render_template, request
from config import url_for2
from imperial_ldap.auth import login_required
home_blueprint = Blueprint('home', __name__, url_prefix='/')
......@@ -13,3 +14,27 @@ def index():
def dashboard(user):
return render_template('dashboard.html', user=user)
# Example route with database interaction:
# @home_blueprint.route('/entities', methods=['GET', 'POST'])
# @login_required
# def entities(user):
# if request.method == "GET":
# try:
# rows = ""
# for e in db.session.query(Entity).all():
# rows += str(e) + "<br>"
# return rows
# except:
# return "App database error"
# else:
# name = request.form.get('name')
# age = request.form.get('age')
# try:
# db.session.add(Entity(name=name, age=int(age)))
# db.session.commit()
# return redirect(url_for2('.entities'))
# except:
# return "Could not add entity."
......@@ -23,18 +23,4 @@
<h3>Welcome back, {{ user.name }} {{ user.surname }}!</h3>
<h6>Example CRUD form - Create a record in the database:</h6>
<form method="post" action="{{ url('home.entities') }}">
Name:<br>
<input type="text" name="name">
<br>
Age:<br>
<input type="number" name="age">
<br>
<button type="submit">Create Entry</button>
</form>
<br>
<a href="{{ url('home.entities') }}">View records</a>
{% endblock %}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment