14 lines
455 B
Python
14 lines
455 B
Python
|
from django.contrib.sites.models import Site
|
||
|
from django.core.management.base import BaseCommand, CommandError
|
||
|
|
||
|
|
||
|
class Command(BaseCommand):
|
||
|
help = 'Add a site'
|
||
|
|
||
|
def add_arguments(self, parser):
|
||
|
parser.add_argument('domain', type=str)
|
||
|
|
||
|
def handle(self, *args, **options):
|
||
|
site = Site.objects.create(domain=options['domain'], name=options['domain'])
|
||
|
self.stdout.write(self.style.SUCCESS('Created site {}'.format(site)))
|