2012-11-21 22:31:42 +01:00
|
|
|
from django.core.management.base import BaseCommand
|
|
|
|
from zephyr.models import Realm, Message, UserProfile, Recipient, create_stream_if_needed, \
|
2012-12-04 21:32:58 +01:00
|
|
|
get_client, do_create_realm
|
2012-11-21 22:31:42 +01:00
|
|
|
from zephyr.views import do_send_message
|
|
|
|
from django.utils.timezone import now
|
|
|
|
|
|
|
|
class Command(BaseCommand):
|
|
|
|
help = "Create a realm for the specified domain(s)."
|
|
|
|
|
|
|
|
def handle(self, *args, **options):
|
|
|
|
for domain in args:
|
2012-12-04 21:32:58 +01:00
|
|
|
realm, created = do_create_realm(domain)
|
|
|
|
if created:
|
2012-11-21 22:31:42 +01:00
|
|
|
print domain + ": Created."
|
2012-12-04 21:32:58 +01:00
|
|
|
else:
|
|
|
|
print domain + ": Already exists."
|
2012-11-21 22:31:42 +01:00
|
|
|
|