Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
ffb74af3
Commit
ffb74af3
authored
Sep 11, 2014
by
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
Changes
2
Hide whitespace changes
Inline
Side-by-side
snf-admin-app/synnefo_admin/admin/utils.py
View file @
ffb74af3
...
...
@@ -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
=
{}
...
...
snf-admin-app/synnefo_admin/admin/views.py
View file @
ffb74af3
...
...
@@ -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
,
default_view
)
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):
@
admin_user_required
def
catalog
(
request
,
type
=
'user'
):
def
catalog
(
request
,
type
=
default_view
()
):
"""Admin-Interface generic list view."""
admin_log
(
request
,
type
=
type
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment