Merge remote-tracking branch 'origin/master'
# Conflicts: # templates/components/habit_lists.html
This commit is contained in:
commit
d340a1e19f
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()
|
||||||
@ -244,7 +245,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'))
|
||||||
@ -271,7 +272,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(
|
||||||
@ -283,7 +284,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'))
|
||||||
@ -387,7 +388,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.'
|
||||||
|
|
||||||
@ -466,9 +467,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
|
||||||
|
|||||||
@ -65,7 +65,7 @@ class User(UserMixin):
|
|||||||
def get_heatmap(self) -> tuple:
|
def get_heatmap(self) -> tuple:
|
||||||
# get current day of week as integer. monday is 0 and sunday is 6
|
# get current day of week as integer. monday is 0 and sunday is 6
|
||||||
weekday = datetime.today().weekday()
|
weekday = datetime.today().weekday()
|
||||||
heatmap = []
|
heatmap = [100]
|
||||||
|
|
||||||
# append the heatmap values of the current week
|
# append the heatmap values of the current week
|
||||||
for day in range(0, weekday):
|
for day in range(0, weekday):
|
||||||
|
|||||||
@ -103,9 +103,7 @@
|
|||||||
<div class="col">
|
<div class="col">
|
||||||
<a href="/users?habit_list={{habit_list.id}}" style="width: 40px; height: 40px; min-height: 3em;"
|
<a href="/users?habit_list={{habit_list.id}}" style="width: 40px; height: 40px; min-height: 3em;"
|
||||||
data-toggle="tooltip" data-placement="top" title="Benutzer einladen">
|
data-toggle="tooltip" data-placement="top" title="Benutzer einladen">
|
||||||
|
<i class="bi bi-person-fill-add" style="font-size: 24px;"></i>
|
||||||
<i class="bi bi-person-fill-add"></i>
|
|
||||||
|
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|||||||
@ -16,7 +16,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<label>
|
||||||
<input hidden="hidden" name="habit_list_id" value="{{ habit_list.id }}">
|
<input hidden="hidden" name="habit_list_id" value="{{ habit_list.id }}">
|
||||||
|
</label>
|
||||||
|
|
||||||
<!-- submit button -->
|
<!-- submit button -->
|
||||||
<button type="submit" class="btn btn-primary">Einladen</button>
|
<button type="submit" class="btn btn-primary">Einladen</button>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user