horizon/openstack_dashboard/contrib/developer/dashboard.py
Michal Arbet a25d6b3312 Fix developer panel when debug is set to False
When developer panel is enabled in horizon via local enabled files,
and in local_settings.py is DEBUG = False,horizon start without
whole left side panel because dashboard with slug "developer"
is not registered. Correct fix is to register, but set it to not allowed.

Change-Id: Icbfc9ba11b07d6dbc33ed60df0dcf84dc4141429
Closes-Bug: 1812230
2019-01-20 13:13:52 +01:00

33 lines
1.0 KiB
Python

# Copyright 2015 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
import horizon
class Developer(horizon.Dashboard):
name = _("Developer")
slug = "developer"
default_panel = "theme_preview"
def allowed(self, context):
if not getattr(settings, 'DEBUG', False):
return False
return super(Developer, self).allowed(context)
horizon.register(Developer)