django - dynamic form fieldsets

Posted by user110029 on Stack Overflow See other posts from Stack Overflow or by user110029
Published on 2010-04-12T21:14:38Z Indexed on 2010/04/12 21:42 UTC
Read the original article Hit count: 668

A form will be spitting out an unknown number of questions to be answered. each question contains a prompt, a value field, and a unit field. The form is built at runtime in the formclass's init method.

I'd like each question rendered on the form as an inline: prompt, value(input-text), units (select).

this seems a case perfect for iterable form fieldsets, which could be easily styled. but since fieldsets - such as those in django-form-utils are defined as tuples, they are immutable... and I can't find a way to define them at runtime. is this possible, or perhaps another solution?

© Stack Overflow or respective owner

Related posts about django-templates

Related posts about django-forms