← Back to team overview

openstack team mailing list archive

Re: Adding panel to a dashboard - Horizon

 

My guess would be that your panel module is not being imported anywhere, and thus not ever discovered. There are several ways that discovery can happen:


1.       If your panel module lives inside a dashboard that lists it in the "panels" attribute on the Dashboard class, it will be discovered automatically.

2.       If your panel module lives elsewhere on your Python path you can add it to the list of INSTALLED_APPS in your settings file.

3.       Alternatively, if you import the panel.py file somewhere in your code before the Horizon URL structure is generated, it will also be discovered. A good place to do that is at the top of the site's root urls.py file, or by using the customization_module option described here: http://horizon.openstack.org/topics/customizing.html#modifying-existing-dashboards-and-panels

In the end it comes down to how your codebase is structured. But otherwise your code looks good to me. I'd guess it just needs to get executed.


-          Gabriel

From: openstack-bounces+gabriel.hurley=nebula.com@xxxxxxxxxxxxxxxxxxx [mailto:openstack-bounces+gabriel.hurley=nebula.com@xxxxxxxxxxxxxxxxxxx] On Behalf Of Guillermo Alvarado
Sent: Monday, June 04, 2012 10:48 AM
To: openstack@xxxxxxxxxxxxxxxxxxx
Subject: [Openstack] Adding panel to a dashboard - Horizon

Hi everyone!

I want to add a panel to settings dashboard. This panel is named 'Password' and here the users will be able to modify your password (This will be programmed).
My problem is that I can not add another panel (I dont see the option Password in the Settings dashboard). I did the following:

1.- Added a folder named password in  /horizon/dashboards/settings
2.- A added the __init__.py file into password folder
3.- Added the views.py file into password folder with this content:

    from django import shortcuts

    def index(request):
        return shortcuts.render(request, 'settings/password/password.html', {})

4.- Added urls.py file into password folder with this content:

    from django.conf.urls.defaults import patterns, url
    from .views import IndexView

    urlpatterns = patterns('horizon.dashboards.settings.password.views',
        url(r'^$', IndexView.as_view(), name='index'),
    )

5.-Added panel.py file into password folder with this content:

    from django.utils.translation import ugettext_lazy as _
    import horizon
    from horizon.dashboards.settings import dashboard

    class Password(horizon.Panel):
        name = _("Password")
        slug = 'password'

    dashboard.Settings.register(Password)

6.- In dashboard.py file located in /horizon/dashboard/settings added password to panels:
    panels = ('user', 'project', 'ec2', 'password')


But I not see the password panel. What is the problem?

Any answer will be apreciated, thanks in advance!

Best Regards,
Guillermo Alvarado

References