Add admin template

master
Neslihan 4 years ago
parent bf105f7048
commit 9de55402f9
  1. 4
      app/routes.py
  2. 5
      app/templates/admin.html

@ -31,7 +31,7 @@ def register():
@app.route('/login', methods=['GET', 'POST']) @app.route('/login', methods=['GET', 'POST'])
def login(): def login():
if current_user.is_authenticated: if current_user.is_authenticated:
return redirect(url_for('index')) return redirect(url_for('admin'))
form = LoginForm() form = LoginForm()
if form.validate_on_submit(): if form.validate_on_submit():
user = User.query.filter_by(username=form.username.data).first() user = User.query.filter_by(username=form.username.data).first()
@ -46,7 +46,7 @@ def login():
@app.route('/admin') @app.route('/admin')
@login_required @login_required
def admin(): def admin():
return "Hello, World!" return render_template('admin.html')
@app.route('/logout') @app.route('/logout')

@ -0,0 +1,5 @@
{% extends "base.html" %}
{% block content %}
<h1>Hi, {{ current_user.username }}!</h1>
{% endblock %}
Loading…
Cancel
Save