export: Export user groups.

This commit is contained in:
Rhea Parekh 2018-07-11 23:27:15 +05:30 committed by Tim Abbott
parent bc2307108d
commit 98a7762a51
1 changed files with 16 additions and 3 deletions

View File

@ -19,7 +19,8 @@ from zerver.models import UserProfile, Realm, Client, Huddle, Stream, \
RealmDomain, Recipient, DefaultStream, get_user_profile_by_id, \
UserPresence, UserActivity, UserActivityInterval, CustomProfileField, \
CustomProfileFieldValue, get_display_recipient, Attachment, get_system_bot, \
RealmAuditLog, UserHotspot, MutedTopic, Service
RealmAuditLog, UserHotspot, MutedTopic, Service, UserGroup, \
UserGroupMembership
from zerver.lib.parallel import run_parallel
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, \
Iterable, Union
@ -168,8 +169,6 @@ NON_EXPORTED_TABLES = {
'zerver_botstoragedata',
'zerver_botconfigdata',
'zerver_pushdevicetoken',
'zerver_usergroup',
'zerver_usergroupmembership',
}
IMPLICIT_TABLES = {
@ -541,6 +540,20 @@ def get_realm_config() -> Config:
custom_fetch=fetch_user_profile,
)
Config(
table='zerver_usergroup',
model=UserGroup,
normal_parent=realm_config,
parent_key='realm__in',
)
Config(
table='zerver_usergroupmembership',
model=UserGroupMembership,
normal_parent=user_profile_config,
parent_key='user_group__in',
)
Config(
custom_tables=[
'zerver_userprofile_crossrealm',