postgresql数据库实用操作

查模型的列名:

select column_name from information_schema.columns  where table_name= 'your_table';

应用:

1. 给django的模型自动生成模板:

select '<tr><td><b>'||replace(column_name,'_',' ')||'</b></td><td>{{form.'||column_name||'}}</td></tr>' from information_schema.columns  where table_name= 'eForm_request_form';

posted @ 2014-08-11 17:19  tommy.yu  阅读(168)  评论(0编辑  收藏  举报