cleaned code
yippie
This commit is contained in:
parent
ca9168cff4
commit
11104fe96b
14
app.py
14
app.py
@ -1,7 +1,6 @@
|
|||||||
import datetime
|
import datetime
|
||||||
import hashlib
|
import hashlib
|
||||||
import os
|
import os
|
||||||
# import imageio
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
from flask import Flask, render_template, redirect, url_for, request, jsonify
|
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
|
# Create a new Flask instance
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app.secret_key = 'PSSSSSHHHT!'
|
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
|
# Initialize the Flask-Login extension
|
||||||
login_manager = LoginManager()
|
login_manager = LoginManager()
|
||||||
@ -243,7 +244,7 @@ def habit_create():
|
|||||||
unit = 1
|
unit = 1
|
||||||
|
|
||||||
# Save habit to database
|
# Save habit to database
|
||||||
habit = Habit.create(list_id, name, times, note, unit)
|
Habit.create(list_id, name, times, note, unit)
|
||||||
|
|
||||||
# Back to index
|
# Back to index
|
||||||
return redirect(url_for('index'))
|
return redirect(url_for('index'))
|
||||||
@ -270,7 +271,7 @@ def habit_list_create():
|
|||||||
if not name:
|
if not name:
|
||||||
errors['name'] = 'Der Name ist erforderlich.'
|
errors['name'] = 'Der Name ist erforderlich.'
|
||||||
if not description:
|
if not description:
|
||||||
note = ''
|
description = ''
|
||||||
|
|
||||||
if errors:
|
if errors:
|
||||||
return render_template(
|
return render_template(
|
||||||
@ -282,7 +283,7 @@ def habit_list_create():
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Save habit to database
|
# Save habit to database
|
||||||
habit = HabitList.create(current_user.id, name, description)
|
HabitList.create(current_user.id, name, description)
|
||||||
|
|
||||||
# Back to index
|
# Back to index
|
||||||
return redirect(url_for('index'))
|
return redirect(url_for('index'))
|
||||||
@ -386,7 +387,7 @@ def edit_habit_change():
|
|||||||
|
|
||||||
# check if list_id is an int
|
# check if list_id is an int
|
||||||
try:
|
try:
|
||||||
list_id = int(list_id)
|
int(list_id)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
errors['list_query'] = 'Die Anzahl muss eine Zahl sein.'
|
errors['list_query'] = 'Die Anzahl muss eine Zahl sein.'
|
||||||
|
|
||||||
@ -465,9 +466,6 @@ def password_change():
|
|||||||
|
|
||||||
|
|
||||||
def save_profile_image(image_file):
|
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
|
filename = image_file.filename
|
||||||
if '.' not in filename:
|
if '.' not in filename:
|
||||||
# Ensure the filename has an extension
|
# Ensure the filename has an extension
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user