Skip to content

Instantly share code, notes, and snippets.

@joshcartme
Created April 23, 2013 17:16
Show Gist options
  • Save joshcartme/5445552 to your computer and use it in GitHub Desktop.
Save joshcartme/5445552 to your computer and use it in GitHub Desktop.
Pull in a menu from a different site than the current in a Mezzanine multi site setup.
from mezzanine.utils.sites import current_site_id
from mezzanine.pages.templatetags.pages_tags import page_menu
from mezzanine import template
register = template.Library()
@register.render_tag
def page_menu_for_site(context, token):
"""
Creates a page menu grabbing pages from the given site_id rather than the
current_site which is default.
"""
old_site_id = current_site_id()
context['request'].site_id = settings.DISTRICT_SITE_ID
menu = page_menu(context, token)
retval = menu.render(context)
context['request'].site_id = old_site_id
return retval
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment