Add method to nuke all user related content
Specifically, all users that are not a superuser
This commit is contained in:
parent
fc59bf0b6d
commit
1c4c1a8494
|
|
@ -0,0 +1,13 @@
|
||||||
|
from wagtail.admin.forms.account import User
|
||||||
|
from assignments.models import Assignment
|
||||||
|
from objectives.models import Objective
|
||||||
|
from rooms.models import Comment
|
||||||
|
|
||||||
|
|
||||||
|
def nuke_users():
|
||||||
|
# todo: make sure the user confirms this when called from a django command
|
||||||
|
Objective.objects.exclude(owner=None).delete()
|
||||||
|
Comment.objects.all().delete()
|
||||||
|
Assignment.objects.exclude(owner=None).exclude(owner__username="guru").delete()
|
||||||
|
|
||||||
|
User.objects.filter(is_superuser=False).delete()
|
||||||
Loading…
Reference in New Issue