19 lines
698 B
Python
19 lines
698 B
Python
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: exclude some users, but exclude them from all the deletion steps
|
|
# e.g.
|
|
# excluded_users=[]
|
|
# Objective.objects.exclude(owner=None).exclude(owner__username__in=excluded_users).delete()
|
|
#
|
|
# 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()
|