Diplay database column headers on HTML programmatically

19 views
Skip to first unread message

Kishan Mehta

unread,
Apr 12, 2015, 1:38:39 AM4/12/15
to django...@googlegroups.com
Hey Friends,

There is a model.py and i want to add its column headers in drop down
list in HTML.
Any way to pass them through views.py ?
Dont want to hardcode at HTML because too many columns .
Thanks for the help.

Regards,
Kishan

Mike Dewhirst

unread,
Apr 12, 2015, 2:51:26 AM4/12/15
to django...@googlegroups.com
On 12/04/2015 3:38 PM, Kishan Mehta wrote:
> Hey Friends,
>
> There is a model.py and i want to add its column headers in drop down
> list in HTML.
> Any way to pass them through views.py ?
> Dont want to hardcode at HTML because too many columns .

You probably want
https://docs.djangoproject.com/en/1.8/ref/models/meta/#retrieving-all-field-instances-of-a-model

but check here too ...

https://docs.djangoproject.com/en/1.8/releases/1.8/#model-meta-api
Reply all
Reply to author
Forward
0 new messages