Ham radio contest management website for the CQTU by DK0TU https://dk0tu.de
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

clear_contest.py 780B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/env python
  2. from __future__ import print_function
  3. import datetime
  4. # prepare environment
  5. import sys
  6. sys.path.append("..")
  7. import os
  8. os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cqtu.settings")
  9. import django
  10. django.setup()
  11. confirm = raw_input("Do are you sure you want to clear all contest data? Answer with uppercase YES: ")
  12. if confirm != "YES":
  13. print("Aborting")
  14. sys.exit(1)
  15. from contest.models import QSO, ShadowCall, Reference, User
  16. print("{0} QSOs deleted".format(*QSO.objects.all().delete()))
  17. print("{0} ShadowCalls deleted".format(*ShadowCall.objects.all().delete()))
  18. print("{0} References deleted".format(*Reference.objects.all().delete()))
  19. print("{0} Users deleted".format(*User.objects.filter(is_superuser=0).delete()))
  20. print()
  21. print("Good to go!")