2020-01-20 22:14:22 +01:00
|
|
|
#!/usr/bin/env python
|
|
|
|
from __future__ import print_function
|
|
|
|
|
|
|
|
# prepare environment
|
|
|
|
import sys
|
|
|
|
sys.path.append("..")
|
|
|
|
import os
|
|
|
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cqtu.settings")
|
|
|
|
import django
|
|
|
|
django.setup()
|
|
|
|
|
2020-01-26 11:35:28 +01:00
|
|
|
confirm_msg = "Do are you sure you want to clear all contest data? Answer with uppercase YES: "
|
|
|
|
try:
|
|
|
|
confirm = raw_input(confirm_msg)
|
|
|
|
except NameError:
|
|
|
|
confirm = input(confirm_msg)
|
2020-01-20 22:14:22 +01:00
|
|
|
|
|
|
|
if confirm != "YES":
|
2020-01-26 11:35:28 +01:00
|
|
|
print("Aborting")
|
|
|
|
sys.exit(1)
|
2020-01-20 22:14:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
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!")
|