Skip to content

Instantly share code, notes, and snippets.

@ebsaral
Created December 22, 2013 12:18
Show Gist options
  • Save ebsaral/8081839 to your computer and use it in GitHub Desktop.
Save ebsaral/8081839 to your computer and use it in GitHub Desktop.
import my_app
@register.assignment_tag(takes_context=True)
def get_menu(context, request):
"""
:type request: WSGIRequest
"""
if not isinstance(request, WSGIRequest):
return None
# Try to get app list
template_response = admin.site.index(request)
template_response_my_admin = my_app.admin.my_adminsite_instance.index(request)
try:
app_list = template_response.context_data['app_list'] + template_response_my_admin.context_data['app_list']
except Exception:
return
return Menu(context, request, app_list).get_app_list()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment