Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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