NDOJ/judge/management/commands/addjudge.py

18 lines
495 B
Python
Raw Permalink Normal View History

2020-01-21 06:35:58 +00:00
from django.core.management.base import BaseCommand
from judge.models import Judge
class Command(BaseCommand):
2022-05-14 17:57:27 +00:00
help = "create a judge"
2020-01-21 06:35:58 +00:00
def add_arguments(self, parser):
2022-05-14 17:57:27 +00:00
parser.add_argument("name", help="the name of the judge")
parser.add_argument("auth_key", help="authentication key for the judge")
2020-01-21 06:35:58 +00:00
def handle(self, *args, **options):
judge = Judge()
2022-05-14 17:57:27 +00:00
judge.name = options["name"]
judge.auth_key = options["auth_key"]
2020-01-21 06:35:58 +00:00
judge.save()