python - Display database table columns according to the table -
hi have following code display tables in database (python json formated view)
class dbtablesresourceview(jsonresponsemixin, view): def get(self, request, *args, **kwargs): status = 'error' msg = "success" 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)))
and have drop-down option display tables in html below. used angular js display drop-down list.
<div class="input-group well"> <span class="input-group-addon addon">table </span> <select type="input" class="form-control" ng-model="final_data.table" ng-options="t t in table_list" required ng-cloak></select> </div>
my goal here display columns of user selected table in drop-down option. how can that? since django tastiepie not idea that. helping hands please. in advance.
Comments
Post a Comment