Tuesday, August 30, 2011

dynamic use of django form widgets in template

Hi,

I have a dictionary of field names and a their type. I want to use
this in the html template to render form widgets for the correct type
for each field.

Am I better off rendering the html in the python view and then passing
it through as content?

Example:
data = {'name' : 'string', 'age' : 'int'}

form.html
{% for key in data %}
<render widget>
{% endfor %}


Any help appreciated,

Bob

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment