Hi,

  I have run into a problem that doesn't seem to have a trivial
solution in Django:  I would like to have a form field that contains
parts of the html output so that it is not rendered directly by
Widget.render(), but in the template itself.

On a more concrete basis, let there be a forms.Form  with a
MultipleChoiceField form field whose widget produces a collection of
checkboxes. I could simply override the CheckboxSelectMultiple's
render() function in order to group them in various ways, but I am
aiming for a more flexible approach. Suppose that I have already
overridden the render() function so that it produces a dictionary
containing the html code for each checkbox separately. What I would
like to have in the template is:

{{ form.tueren.A}}
{{ form.tueren.B }},
etc.

Now, adding attributes/methods to the MultipleChoiceField instance is
easy, but since what the template sees is a BoundField() instance, I
have no way to access my additional attributes. Did anybody encounter
this problem already and how can it be solved in an elegant way?

Best regards,
Venelin Petkov





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

Reply via email to