Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

send_custom_email: Pass realm as arg to select_related.

Sahil Batra577555e5293c
diff --git a/zerver/management/commands/send_custom_email.py b/zerver/management/commands/send_custom_email.py
index 7fd04aa2e7a..cc830c94a5a 100644
--- a/zerver/management/commands/send_custom_email.py
+++ b/zerver/management/commands/send_custom_email.py
@@ -129,7 +129,7 @@ class Command(ZulipBaseCommand):
# We need to do a new query because the `get_users` path
# passes us a list rather than a QuerySet.
users = (
- UserProfile.objects.select_related()
+ UserProfile.objects.select_related("realm")
.filter(id__in=[u.id for u in users])
.exclude(
Q(tos_version=None) | Q(tos_version=UserProfile.TOS_VERSION_BEFORE_FIRST_LOGIN)