cleaned code

yippie
This commit is contained in:
Yapollon 2024-03-07 15:56:06 +01:00
parent ca9168cff4
commit 11104fe96b

14
app.py
View File

@ -1,7 +1,6 @@
import datetime
import hashlib
import os
# import imageio
from PIL import Image
from flask import Flask, render_template, redirect, url_for, request, jsonify
@ -16,6 +15,8 @@ from utils import anonymous_required
# Create a new Flask instance
app = Flask(__name__)
app.secret_key = 'PSSSSSHHHT!'
UPLOAD_FOLDER = 'static/profile_images/' # Folder to store profile images
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
# Initialize the Flask-Login extension
login_manager = LoginManager()
@ -243,7 +244,7 @@ def habit_create():
unit = 1
# Save habit to database
habit = Habit.create(list_id, name, times, note, unit)
Habit.create(list_id, name, times, note, unit)
# Back to index
return redirect(url_for('index'))
@ -270,7 +271,7 @@ def habit_list_create():
if not name:
errors['name'] = 'Der Name ist erforderlich.'
if not description:
note = ''
description = ''
if errors:
return render_template(
@ -282,7 +283,7 @@ def habit_list_create():
)
# Save habit to database
habit = HabitList.create(current_user.id, name, description)
HabitList.create(current_user.id, name, description)
# Back to index
return redirect(url_for('index'))
@ -386,7 +387,7 @@ def edit_habit_change():
# check if list_id is an int
try:
list_id = int(list_id)
int(list_id)
except ValueError:
errors['list_query'] = 'Die Anzahl muss eine Zahl sein.'
@ -465,9 +466,6 @@ def password_change():
def save_profile_image(image_file):
UPLOAD_FOLDER = 'static/profile_images/' # Folder to store profile images
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
filename = image_file.filename
if '.' not in filename:
# Ensure the filename has an extension