Display database table columns according to the table
<p>Hi I have following code to display all the tables in my database (Python JSON formated view)</p>

<pre><code>class DbTablesResourceView(JSONResponseMixin, View):
    def get(self, request, *args, **kwargs):
        status = 'error'
        msg = "Success"
        from django.db import connection
        tables = connection.introspection.table_names()
        seen_models = connection.introspection.installed_models(tables)
        return self.render_json_response(dict(objects=list(tables)))
</code></pre>

<p>and I have a drop-down option to display all the tables in html as below. Used angular Js to display as a drop-down list.</p>

<pre><code>    &lt;div class="input-group well"&gt;
       &lt;span class="input-group-addon addon"&gt;Table &lt;/span&gt;
       &lt;select type="input" class="form-control" ng-model="final_data.table"
       ng-options="t for t in table_list" required ng-cloak&gt;&lt;/select&gt;
   &lt;/div&gt;
</code></pre>

<p>My goal here is to display the columns of the user selected table in another drop-down option. How can I do that? Since Django tastiepie will not be a good idea to do that. Some helping hands please. Thanks in advance. </p>