diff --git a/src/api/store/community.py b/src/api/store/community.py index 42c9400cb..503704098 100644 --- a/src/api/store/community.py +++ b/src/api/store/community.py @@ -26,7 +26,7 @@ CommunityMember, CommunityNotificationSetting, ContactUsPageSettings, CustomCommunityWebsiteDomain, \ DonatePageSettings, EventsPageSettings, FeatureFlag, get_enabled_flags, Goal, Graph, HomePageSettings, \ ImpactPageSettings, Location, \ - Media, RealEstateUnit, RegisterPageSettings, SigninPageSettings, Subdomain, TeamsPageSettings, \ + Media, Menu, RealEstateUnit, RegisterPageSettings, SigninPageSettings, Subdomain, TeamsPageSettings, \ TestimonialsPageSettings, UserProfile, VendorsPageSettings from database.utils.common import json_loader from .utils import (get_community, get_community_or_die, get_new_title, get_user_from_context, is_reu_in_community) @@ -103,6 +103,23 @@ def check_community_membership(feature_flag, should_enable, community): else: feature_flag.communities.add(community) feature_flag.save() + + +def create_default_menu(community): + if not community: return None +# load the default menu json + default_menu_json = json_loader("database/raw_data/portal/menu.json") + menu = Menu( + community=community, + name="{} - Default Menu".format(community.subdomain), + is_custom=True, + is_published=True, + content=default_menu_json.get("PortalMainNavLinks", []), + footer_content=default_menu_json.get("PortalFooterLinks", {}), + contact_info=default_menu_json.get("PortalFooterContactInfo", {}), + ) + menu.save() + class CommunityStore: @@ -760,6 +777,7 @@ def create_community( # clone everything for this community homePage = HomePageSettings.objects.filter(is_template=True).first() + create_default_menu(community) images = homePage.images.all() # TODO: make a copy of the images instead, then in the home page, you wont have to create new files everytime if homePage: