Skip to main content

Posts

Showing posts with the label horizon

Customising the Link attribute in Horizon dashboard's DataTable

I had a quick dab at Django & Openstack Horizon frameworks in order to build a dashboard for one of our Openstack projects. Our requirement was to show a table on the UI with the corresponding CRUD functions. I had used DataTable for this purpose, where in you define the table structure in tables.py and the view rendering is defined in views.py If a column is defined to be a link, DataTable by default uses the object id of each row to generate the corresponding link. In my scenario, I needed the link to point to a different object. Openstack's documentation was not very helpful and a quick grep through the openstack's code gave me the idea. The approach to generate a custom link is as follows inside a DataTable: from django.core.urlresolvers import reverse def get_custom_link(datum):     return reverse('horizon:myproject:mydashboard:detail', kwargs={'key': datum.value}) The value of the key will be used to generate the URL. ...

Setting up Python Django dev environment

Django is a python web development framework that helps in rapid application development. Once you are comfortable with the basics, developing UI applications with Django framework is a breeze and helps the developers to focus on the problem at hand rather than on UI nitty gritty. An understanding of this framework is a must in order to develop applications for Openstack Horizon module. In this article, I will list out the steps that need to be carried out to get a Django setup ready for the initial learning phase. At the end of this article, I have included all the links that I have followed when I initially learnt this framework.