from __future__ import absolute_import from typing import Any from django.core.management.base import BaseCommand from zerver.models import Subscription class Command(BaseCommand): help = """One-off script to migration users' stream notification settings.""" def handle(self, *args, **options): # type: (*Any, **Any) -> None for subscription in Subscription.objects.all(): subscription.desktop_notifications = subscription.notifications subscription.audible_notifications = subscription.notifications subscription.save(update_fields=["desktop_notifications", "audible_notifications"])