ソースを参照

delete groups

cube 1 日 前
コミット
9b550a66fa
共有2 個のファイルを変更した15 個の追加2 個の削除を含む
  1. 11
    0
      myriad/manage.py
  2. 4
    2
      myriad/templates/manage/groups.html

+ 11
- 0
myriad/manage.py ファイルの表示

@@ -271,4 +271,15 @@ def group_edit(gid):
271 271
         db.execute("UPDATE groups SET group_name=(?), group_description=(?), public=(?) WHERE id=(?)",(name, desc, privacy, gid))
272 272
         db.commit()
273 273
 
274
+    return redirect(url_for("manage.groups"))
275
+
276
+@bp.route("/group_delete/<gid>")
277
+@login_required
278
+def group_delete(gid):
279
+    db = get_db()
280
+
281
+    db.execute("DELETE FROM groups WHERE id=(?)",(gid,))
282
+    db.execute("DELETE FROM group_members WHERE group_id=(?)",(gid,))
283
+    db.commit()
284
+
274 285
     return redirect(url_for("manage.groups"))

+ 4
- 2
myriad/templates/manage/groups.html ファイルの表示

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