<div dir="ltr"><div><div>Hello,<br><br></div>thanks for reply. Yes I have model for data in the models.py file. I am able to show empty table in the panel but what I do not know is how the code of the function "get_data" in the views.py file should look like. When I try to look to another views.py files I can see that openstack api is used, but I can not use this api I have my own MySQL database outside openstack. <br>
<br></div><div>I will provide pieces of code for better picture.(for simplicity just for one attribute)<br><br></div><div>TABLES.PY<br>_______________<br><br>class BackupTable(tables.DataTable):<br>    node = tables.Column("node_name",<br>
                                        verbose_name=_("Node Name"))<br></div><div><div>class Meta:<br>        name = "backup"<br>        verbose_name = _("Backup")<br><br></div><div>MODELS.PY<br>
_______________<br><br>class Tsm_nodes(models.Model):<br>    node_name = models.CharField(max_length=30)<br><br></div><div>VIEWS.PY<br>_______________<br><br>class BackupIndexView(tables.DataTableView):<br>    table_class = project_tables.BackupTable<br>
    template_name = 'admin/backup/index.html'<br><br>    def get_data(self):<br>        backup=[]<br></div><div>        ???what here???<br></div><div>        return backup<br><br></div><div>MySQL TABLE<br>_______________<br>
<br>mysql> show columns from nodes;<br>+------------------+----------------+--------+-----+-----------+----------------+<br>| Field            | Type         |  Null  | Key| Default |    Extra    |<br>+------------------+----------------+--------+-----+-----------+----------------+<br>
| node_name  | varchar(30) | YES |       | NULL   |                |<br>+------------------+----------------+--------+-----+-----------+----------------+<br><br></div><div>Thanks much for help !!!!<br><br></div><div>Lukas
</div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-06-30 13:53 GMT+02:00 Matthias Runge <span dir="ltr"><<a href="mailto:mrunge@redhat.com" target="_blank">mrunge@redhat.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Thu, Jun 26, 2014 at 05:36:07PM +0200, Lukáš Vízner wrote:<br>
> Hi,<br>
><br>
> I have specific task that I need to create a new panel in horizon<br>
> dashboard. In this panel I need to create table and in this table I need to<br>
> show data from my specific database table.<br>
><br>
> I have created the new panel and table, I have prepared my database table,<br>
> but now I donť know how to work with it all to connect to my database, read<br>
> data from the database table and show it in the horizon table, because in<br>
> the example files from others panels is openstack api used. I would need to<br>
> read data directly from the database. Is this possible? What steps should I<br>
> follow now ?<br>
><br>
> Could anybody help me to solve this issue?<br>
><br>
</div></div>Do you have a model for you data used? The Django docs are quite good at<br>
this point[1].<br>
<br>
HTH, Matthias<br>
<br>
<br>
[1] <a href="https://docs.djangoproject.com/en/1.6/topics/db/queries/" target="_blank">https://docs.djangoproject.com/en/1.6/topics/db/queries/</a><br>
<span class="HOEnZb"><font color="#888888">--<br>
Matthias Runge <<a href="mailto:mrunge@redhat.com">mrunge@redhat.com</a>><br>
<br>
_______________________________________________<br>
Mailing list: <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack</a><br>
Post to     : <a href="mailto:openstack@lists.openstack.org">openstack@lists.openstack.org</a><br>
Unsubscribe : <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack</a><br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br>Lukáš Vízner<br>
</div>