Wednesday, July 26, 2017

forms.Form.to_div ? and how override forms.Boundfield.label_tag?

Hi All,

Just started a few weeks ago with (v1.11) Django (coming from Rails) and I love it! Kudos to all the dev's!

I'm fiddling with creating forms. What would be the best approach to add a to_div method to the forms.Form class ? many frameworks (bootstrap, semantic-ui, etc.)  are using:

<div class="field"> <div class="ui checkbox"> <input type="checkbox" tabindex="0" class="hidden"> <label>I agree to the Terms and Conditions</label> </div>
</div>

..to group fields (label + input). 

I understand I can make my own form template and just loop over the fields. But nicer would be (imo) if you can use a to_div method om the form. 

Another thing I ran into is the usage of the form label. Unlike the input fields that you can easily override via the widget html templates, the label you can not. This is implemented in the Boundfield label_tag method. What would be the best way to change its default behaviour?

Thanks!
36R

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d5a2df9b-e9ea-4cd6-8fb2-355a38bacd03%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment