Browse Source

delete groups

cube 1 day ago
parent
commit
9b550a66fa
2 changed files with 15 additions and 2 deletions
  1. 11
    0
      myriad/manage.py
  2. 4
    2
      myriad/templates/manage/groups.html

+ 11
- 0
myriad/manage.py View File

271
         db.execute("UPDATE groups SET group_name=(?), group_description=(?), public=(?) WHERE id=(?)",(name, desc, privacy, gid))
271
         db.execute("UPDATE groups SET group_name=(?), group_description=(?), public=(?) WHERE id=(?)",(name, desc, privacy, gid))
272
         db.commit()
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
     return redirect(url_for("manage.groups"))
285
     return redirect(url_for("manage.groups"))

+ 4
- 2
myriad/templates/manage/groups.html View File

6
 
6
 
7
 {% block content %}
7
 {% block content %}
8
 
8
 
9
-  <div class="heading">Create new group</div>
9
+  <div class="heading big">Create new group</div>
10
   <form method="post">
10
   <form method="post">
11
     <label for="name">Name</label>
11
     <label for="name">Name</label>
12
     <input name="name" id="name" required><br>
12
     <input name="name" id="name" required><br>
16
   </form>
16
   </form>
17
 
17
 
18
   <div class="heading big">Edit Groups</div>
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
   {% for group in groups %}
21
   {% for group in groups %}
20
     <form method="post" action="{{url_for('manage.group_edit', gid=group[0])}}">
22
     <form method="post" action="{{url_for('manage.group_edit', gid=group[0])}}">
21
       <label for="name">Name</label>
23
       <label for="name">Name</label>
28
       <label for="private">Private</label><br>
30
       <label for="private">Private</label><br>
29
       <input type="submit" value="Submit">
31
       <input type="submit" value="Submit">
30
     </form>
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
     <hr>
34
     <hr>
33
   {% endfor %}
35
   {% endfor %}
34
 
36