Renamed template and created page for habit creation in controller

This commit is contained in:
Verox001 2024-01-19 10:50:35 +01:00
parent 729d11f1c9
commit 8463c01133

18
app.py
View File

@ -141,6 +141,18 @@ def logout():
return redirect(url_for('index'))
@app.route('/habit')
@login_required
def habit_creation():
return render_template(
'habit.html',
title='Erstelle ein Habit',
unit=1,
errors={},
habits=current_user.get_habits()
)
@app.route('/habit', methods=['POST'])
@login_required
def habit_create():
@ -168,7 +180,8 @@ def habit_create():
if errors:
return render_template(
'index.html',
'habit.html',
title='Erstelle ein Habit',
name=name,
note=note,
times=times,
@ -194,7 +207,8 @@ def habit_create():
# Back to index
return render_template(
'index.html',
'habit.html',
title='Erstelle ein Habit',
name=name,
note=note,
times=times,