Oben wird man gebittet sich anzumelden wenn man nicht angemeldet ist. ansonsten wird man mit seinem Namen gegrüßt.

This commit is contained in:
janphilippweinsheimer 2024-01-23 10:22:16 +01:00
parent 48bae38872
commit 5b633c8f42

10
app.py
View File

@ -35,12 +35,15 @@ def index():
if current_user.is_authenticated: if current_user.is_authenticated:
habits = current_user.get_habits() habits = current_user.get_habits()
name = "Hallo " + current_user.name
else: else:
habits = [] habits = []
name = "Bitte melde dich an."
# habits = [("lesen", "eine Seite vor dem schlafen gehen"), ("sport", "3x Gym")] # habits = [("lesen", "eine Seite vor dem schlafen gehen"), ("sport", "3x Gym")]
return render_template( return render_template(
'index.html', 'index.html',
title=name,
utc_dt=datetime.datetime.now().strftime("%d.%m.%Y %H:%M %A"), utc_dt=datetime.datetime.now().strftime("%d.%m.%Y %H:%M %A"),
habits=habits, habits=habits,
errors={}, errors={},
@ -221,13 +224,6 @@ def habit_create():
errors=errors, errors=errors,
) )
@app.route('/test1')
def test1():
return render_template('layouts/indextest1.html', errors={})
@app.route('/test2')
def test2():
return render_template('layouts/indextest2.html', errors={})
# Run the application # Run the application
if __name__ == '__main__': if __name__ == '__main__':