Thanks for your reply..

Subclassing the widget won't help because the widget has no knowledge about 
its label. I'd gladly override the form render method if I could find out 
where that would need to be but the source link 
<https://github.com/django/django/blob/master/django/forms/forms.py#L259> I 
provided in my first snippet would make this seem as its not possible since 
the label is just a piece of string formatting. The manual formatting is 
what I currently have to use but I should think that it should be possible 
to do this even though it doesn't appear as though it is currently.

On Saturday, 16 January 2016 00:47:01 UTC, Tony Flury wrote:
>
>
>
> On Thursday, 14 January 2016 17:55:41 UTC, Sayse wrote:
>>
>> Yea I've heard of it. Have they managed to achieve this? I'd be 
>> interested to see how they've done it if so... 
>>
>> I was hoping to find a way to do this with native django if possible 
>>
>
> One way that might work is to subclass the CheckboxInputWidget, and in 
> the new widget overide the render method - but there looks like a lot of 
> deep Django Magic in that method : 
> https://docs.djangoproject.com/en/1.9/_modules/django/forms/widgets/#CheckboxInput
>
> Or - look at changing the Form render method - again involving lots of 
> Django Magic
>
> Or - Accept that you can't do that (as you are trying to including one 
> widget (Input) inside the HTML tags for another (Label), and compromise 
> with manual ordering and being more explicit in your form : For instance 
> using {{ field.label_tag }} Example here : 
> https://docs.djangoproject.com/en/1.9/topics/forms/#looping-over-the-form-s-fields
>

-- 
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+unsubscr...@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/a1f1226f-dae2-484d-a202-20a85f43ea08%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to