Access realm by string_id in management commands.

`Realm.string_id` replaces 'Realm.domain'
in the management commands.

Fixes #2325.
This commit is contained in:
reyha
2016-11-16 20:16:02 +00:00
committed by Tim Abbott
parent 7f8aef1a17
commit 82e32ad255
25 changed files with 119 additions and 116 deletions

View File

@@ -12,8 +12,10 @@ from zerver.models import Message, UserProfile, Stream, Recipient, UserPresence,
from zerver.lib.actions import STREAM_ASSIGNMENT_COLORS, do_send_message, \
do_change_is_admin
from django.conf import settings
from zerver.lib.bulk_create import bulk_create_streams, bulk_create_users
from zerver.models import DefaultStream, get_stream, get_realm
from zerver.lib.bulk_create import bulk_create_realms, \
bulk_create_streams, bulk_create_users, bulk_create_huddles, \
bulk_create_clients
from zerver.models import DefaultStream, get_stream, get_realm_by_string_id
from zilencer.models import Deployment
import datetime
@@ -185,7 +187,7 @@ class Command(BaseCommand):
subscriptions_to_add.append(s)
Subscription.objects.bulk_create(subscriptions_to_add)
else:
zulip_realm = get_realm("zulip.com")
zulip_realm = get_realm_by_string_id("zulip")
recipient_streams = [klass.type_id for klass in
Recipient.objects.filter(type=Recipient.STREAM)]