delete groups

This commit is contained in:
cube
2026-03-20 18:14:41 +00:00
parent 7ddf77b1ba
commit 9b550a66fa
2 changed files with 15 additions and 2 deletions

View File

@@ -271,4 +271,15 @@ def group_edit(gid):
db.execute("UPDATE groups SET group_name=(?), group_description=(?), public=(?) WHERE id=(?)",(name, desc, privacy, gid))
db.commit()
return redirect(url_for("manage.groups"))
@bp.route("/group_delete/<gid>")
@login_required
def group_delete(gid):
db = get_db()
db.execute("DELETE FROM groups WHERE id=(?)",(gid,))
db.execute("DELETE FROM group_members WHERE group_id=(?)",(gid,))
db.commit()
return redirect(url_for("manage.groups"))

View File

@@ -6,7 +6,7 @@
{% block content %}
<div class="heading">Create new group</div>
<div class="heading big">Create new group</div>
<form method="post">
<label for="name">Name</label>
<input name="name" id="name" required><br>
@@ -16,6 +16,8 @@
</form>
<div class="heading big">Edit Groups</div>
<b>Group privacy settings do not affect members contained within the groups</b><br>
Deleting a group does not delete any members who are part of that group
{% for group in groups %}
<form method="post" action="{{url_for('manage.group_edit', gid=group[0])}}">
<label for="name">Name</label>
@@ -28,7 +30,7 @@
<label for="private">Private</label><br>
<input type="submit" value="Submit">
</form>
<a class="danger">Delete group</a> - WARNING: this action is permanent and irreversible. this will not delete any members contained within the group.
<a href="{{url_for('manage.group_delete', gid=group[0])}}" class="danger">Delete group</a> - WARNING: this action is permanent and irreversible
<hr>
{% endfor %}