mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 12:33:40 +00:00
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:
@@ -11,7 +11,7 @@ import pytz
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.db.models import Count
|
||||
from zerver.models import UserProfile, Realm, Stream, Message, Recipient, UserActivity, \
|
||||
Subscription, UserMessage, get_realm
|
||||
Subscription, UserMessage, get_realm_by_string_id
|
||||
|
||||
MOBILE_CLIENT_LIST = ["Android", "ios"]
|
||||
HUMAN_CLIENT_LIST = MOBILE_CLIENT_LIST + ["website"]
|
||||
@@ -86,7 +86,7 @@ class Command(BaseCommand):
|
||||
# type: (*Any, **Any) -> None
|
||||
if options['realms']:
|
||||
try:
|
||||
realms = [get_realm(domain) for domain in options['realms']]
|
||||
realms = [get_realm_by_string_id(string_id) for string_id in options['realms']]
|
||||
except Realm.DoesNotExist as e:
|
||||
print(e)
|
||||
exit(1)
|
||||
@@ -94,7 +94,7 @@ class Command(BaseCommand):
|
||||
realms = Realm.objects.all()
|
||||
|
||||
for realm in realms:
|
||||
print(realm.domain)
|
||||
print(realm.string_id)
|
||||
|
||||
user_profiles = UserProfile.objects.filter(realm=realm, is_active=True)
|
||||
active_users = self.active_users(realm)
|
||||
|
||||
Reference in New Issue
Block a user