Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
e86c7ac941
18
app.py
18
app.py
@ -777,6 +777,24 @@ def add_user():
|
||||
return redirect(url_for('index', habit_list=habit_list.id))
|
||||
|
||||
|
||||
@app.route('/users-leave')
|
||||
@login_required
|
||||
def user_leave():
|
||||
list_id = request.args.get('habit_list')
|
||||
|
||||
habit_list = HabitList.get(list_id)
|
||||
|
||||
if habit_list is None:
|
||||
return {"error": "List not found"}
|
||||
|
||||
# Check if habit belongs to user
|
||||
if current_user not in habit_list.get_users():
|
||||
return {"error": "List does not belong to user"}
|
||||
|
||||
habit_list.remove_user(current_user.id)
|
||||
return redirect(url_for("index"))
|
||||
|
||||
|
||||
# Run the application
|
||||
if __name__ == '__main__':
|
||||
app.run(host="0.0.0.0", port=5000, debug=True)
|
||||
|
||||
@ -115,7 +115,12 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="col"></div>
|
||||
<div class="col">
|
||||
<a class="me-5" href="/users-leave?habit_list={{habit_list.id}}" style="width: 40px; height: 40px; min-height: 3em;"
|
||||
data-toggle="tooltip" data-placement="top" title="Liste verlassen">
|
||||
<i class="bi bi-box-arrow-left" style="font-size: 24px;"></i>
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="col-4"></div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user