Commit ffb74af3 authored by Alex Pyrgiotis's avatar Alex Pyrgiotis
Browse files

admin: Fix selection of default catalog view

Return the highest-order view type in the `ADMIN_VIEWS_ORDER` setting.
parent 585a5f60
......@@ -52,6 +52,12 @@ model_dict = {
def default_view():
"""Return the first registered view based on ADMIN_VIEWS_ORDER."""
if admin_settings.ADMIN_VIEWS_ORDER:
return admin_settings.ADMIN_VIEWS_ORDER[0]
def __reverse_model_dict():
"""Create the a model dict with the class names as keys."""
reversed_model_dict = {}
......@@ -42,7 +42,8 @@ from synnefo_admin import admin_settings
from synnefo_admin.admin import exceptions
from synnefo_admin.admin.utils import (conditionally_gzip_page,
customize_details_context, admin_log)
customize_details_context, admin_log,
from synnefo.ui.views import UI_MEDIA_URL
......@@ -68,6 +69,9 @@ def get_view_module(view_type):
def get_view_module_or_404(view_type):
"""Try to import a view module or raise 404."""
if not view_type:
raise AdminHttp404("No category provided.")
mod = get_view_module(view_type)
if not mod:
raise AdminHttp404("No category found with this name: %s" % view_type)
......@@ -268,7 +272,7 @@ def details(request, type, id):
def catalog(request, type='user'):
def catalog(request, type=default_view()):
"""Admin-Interface generic list view."""
admin_log(request, type=type)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment