mirror of https://github.com/zulip/zulip.git
initialize_voyager_db: Use do_change_is_admin.
This is a code cleanup; in general, we avoid making direct updates to model objects and then saving with a bare `.save()` across the codebase.
This commit is contained in:
parent
8dfc9d8bca
commit
111139b44e
|
@ -5,6 +5,7 @@ from typing import Any, Iterable, Tuple, Optional
|
|||
from django.conf import settings
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
from zerver.lib.actions import do_change_is_admin
|
||||
from zerver.lib.bulk_create import bulk_create_users
|
||||
from zerver.models import Realm, UserProfile, \
|
||||
email_to_username, get_client, get_system_bot
|
||||
|
@ -51,8 +52,7 @@ class Command(BaseCommand):
|
|||
|
||||
# Initialize the email gateway bot as an API Super User
|
||||
email_gateway_bot = get_system_bot(settings.EMAIL_GATEWAY_BOT)
|
||||
email_gateway_bot.is_api_super_user = True
|
||||
email_gateway_bot.save()
|
||||
do_change_is_admin(email_gateway_bot, True, permission="api_super_user")
|
||||
|
||||
self.stdout.write("Successfully populated database with initial data.\n")
|
||||
self.stdout.write("Please run ./manage.py generate_realm_creation_link "
|
||||
|
|
Loading…
Reference in New Issue