Thursday, July 27, 2017

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

crispy forms is a good addition for form creation http://django-crispy-forms.readthedocs.io/en/latest/.

It gives you a lot of control over layout and templating.

Dan

On 26 July 2017 at 13:02, threesixright <threesixright@gmail.com> wrote:
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.



--
Wildman and Herring Limited, Registered Office: 28 Brock Street, Bath, United Kingdom, BA1 2LN, Company no: 05766374

--
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/CAPZHCY57G%3DT3Hnm8wgp4-BhWnFLiOLFQF_UPMFaqAp7n-w2XtA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment