For me, the BoundField.label_tag method's attrs parameter is one of those 
"what were the designers of Django thinking when they put it in" things. 
Rather than wondering, I'll ask here.

The way to add HTML attributes to a label is to call label_tag with its 
attrs parameter set. label_tag is usually called by templates. Templates 
cannot pass parameters to the methods that they call. Do you see the 
problem?

When this gets discussed on forums, solutions tend to range from building 
custom template tags to monkeypatching BoundField.label_tag. (I went with 
the latter solution here: 
http://duganchen.ca/rendering-django-forms-for-the-twitter-bootstrap/). 
None of these solutions are really great, and I am very, very curious as to 
how it's actually supposed to be done.

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

Reply via email to