Ask Your Question
1

Adding a drop down tab on Dashboard

asked 2013-10-17 07:43:31 -0600

updated 2013-10-20 09:45:06 -0600

Openstack newbie here. I want to add a new drop down tab in the "Create Network" box that pops up on clicking "+Create Network" in the Networks panel of Admin. I don't have a good experience in Django framework.
I have located the file forms.py that has a class CreateNetwork in the path:
/opt/stack/horizon/openstack_dashboard/dashboards/admin/networks.

class CreateNetwork(forms.SelfHandlingForm):
    name = forms.CharField(max_length=255,
                           label=_("Name"),
                           required=False)
    tenant_id = forms.ChoiceField(label=_("Project"))
    if api.neutron.is_port_profiles_supported():
        net_profile_id = forms.ChoiceField(label=_("Network Profile"))
    admin_state = forms.BooleanField(label=_("Admin State"),
                                     initial=True, required=False)
    shared = forms.BooleanField(label=_("Shared"),
                                initial=False, required=False)
    external = forms.BooleanField(label=_("External Network"),
                                  initial=False, required=False)

    ## The new field
    new_field = forms.ChoiceField(choices=[(1, 'Freemium'), (2, 'Basic'), (3, 'Premium')],
                                           label=_("New Field"))
    ##

I added another variable just to see if it is visible in the GUI but it fails. I also tried changing the label names of the fields that was visible, example changing External Network to Network External, to verify if I am in the right file, but the changes were not reflected on the Dashboard.

Can anyone suggest me ways to make changes on the fly such that I can test it's visibility on the dashboard by a normal refresh? Thanks

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
4

answered 2013-10-18 05:39:09 -0600

jpichon gravatar image

You also need to restart your web server after modifying a Python file (sudo service httpd restart or sudo service apache2 restart), to be able to see the changes. I can see the new field just fine, using what you wrote.

Django also has a development server you can use to see changes directly during development, you can start it with python manage.py runserver (this starts the server on port 8000 by default)

See also https://docs.djangoproject.com/en/1.4/intro/tutorial01/#the-development-server , https://docs.djangoproject.com/en/1.4/ref/django-admin/#django-admin-runserver for more information.

edit flag offensive delete link more
0

answered 2015-08-17 04:07:34 -0600

sanjana gravatar image

You can create the drop down by making your class inherit tables.LinkAction in your tables.py file. The changes will be reflected only after you run the following commands in the devstack directory to restart the web server. sudo service apache2 start ./rejoin-stack.sh

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

3 followers

Stats

Asked: 2013-10-17 07:43:31 -0600

Seen: 619 times

Last updated: Aug 17 '15