groups fully implemented

This commit is contained in:
cube
2026-03-19 02:11:09 +00:00
parent 17455fe1c6
commit 528f819030
2 changed files with 23 additions and 4 deletions

View File

@@ -246,4 +246,17 @@ def groups():
groups = db.execute("SELECT * FROM groups").fetchall()
return render_template("manage/groups.html", groups=groups)
return render_template("manage/groups.html", groups=groups)
@bp.route("/group_edit/<gid>", methods=("GET", "POST"))
@login_required
def group_edit(gid):
db = get_db()
if request.method == "POST":
name = request.form["name"]
desc = request.form["desc"]
db.execute("UPDATE groups SET group_name=(?), group_description=(?) WHERE id=(?)",(name, desc, gid))
db.commit()
return redirect(url_for("manage.groups"))

View File

@@ -15,10 +15,16 @@
<input type="submit" value="Submit">
</form>
<div class="heading big">Groups</div>
<div class="heading big">Edit Groups</div>
{% for group in groups %}
<div class="heading">{{group[1]}}</div>
<div class="maintext">{{group[2]}}</div>
<form method="post" action="{{url_for('manage.group_edit', gid=group[0])}}">
<label for="name">Name</label>
<input name="name" id="name" value="{{group[1]}}" required><br>
<label for="desc">Description</label>
<textarea name="desc" id="desc">{{group[2]}}</textarea><br>
<input type="submit" value="Submit">
</form>
<hr>
{% endfor %}
{% endblock %}