skillbox/server/registration/management/commands/create_dummy_license.py

31 lines
909 B
Python

# -*- coding: utf-8 -*-
#
# ITerativ GmbH
# http://www.iterativ.ch/
#
# Copyright (c) 2019 ITerativ GmbH. All rights reserved.
#
# Created on 2019-10-23
# @author: chrigu <christian.cueni@iterativ.ch>
from django.conf import settings
from django.core.management import BaseCommand
from registration.models import LicenseType
from users.models import Role
class Command(BaseCommand):
def handle(self, *args, **options):
try:
role = Role.objects.get(key=Role.objects.TEACHER_KEY)
except Role.DoesNotExist:
print("LicenseType requires that a Teacher Role exsits")
LicenseType.objects.create(name='dummy_license',
for_role=role,
active=True,
key='c1fa2e2a-2e27-480d-8469-2e88414c4ad8',
description='dummy license')