Draft for a clear contest script
Script clears calls, users, references and shadow calls from the database to clean up after the last contest.
This commit is contained in:
parent
500b79e67a
commit
d38c6ada3f
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env python
|
||||
from __future__ import print_function
|
||||
|
||||
import datetime
|
||||
|
||||
# prepare environment
|
||||
import sys
|
||||
sys.path.append("..")
|
||||
import os
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cqtu.settings")
|
||||
import django
|
||||
django.setup()
|
||||
|
||||
confirm = raw_input("Do are you sure you want to clear all contest data? Answer with uppercase YES: ")
|
||||
|
||||
if confirm != "YES":
|
||||
print("Aborting")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
from contest.models import QSO, ShadowCall, Reference, User
|
||||
|
||||
print("{0} QSOs deleted".format(*QSO.objects.all().delete()))
|
||||
print("{0} ShadowCalls deleted".format(*ShadowCall.objects.all().delete()))
|
||||
print("{0} References deleted".format(*Reference.objects.all().delete()))
|
||||
print("{0} Users deleted".format(*User.objects.filter(is_superuser=0).delete()))
|
||||
print()
|
||||
print("Good to go!")
|
Loading…
Reference in New Issue