Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port 1.10 menu changes, default value for MenuManager. #563

Open
wants to merge 1 commit into
base: v2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion suit/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(self, available_apps, context, request):

# Variable available_apps structure:
# https://docs.djangoproject.com/en/1.9/ref/contrib/admin/#adminsite-methods
self.available_apps = available_apps
self.available_apps = available_apps or []

self.context = context
self.request = request
Expand Down
9 changes: 6 additions & 3 deletions suit/templatetags/suit_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ def get_menu(context, request):
try:
from django.contrib import admin
template_response = get_admin_site(request.current_app).index(request)
available_apps = template_response.context_data['app_list']
except Exception:
pass
# Django 1.10 removed the current_app parameter for some classes and functions.
# Check the release notes.
except AttributeError:
template_response = get_admin_site(context.request.resolver_match.namespace).index(request)

available_apps = template_response.context_data['app_list']

if not available_apps:
logging.warn('Django Suit was unable to retrieve apps list for menu.')
Expand Down