Re: Issue when rendering manually a form's HiddenInput

2015-08-07 Thread durirompepc
Yeah, I deleted the post cause I thinked the same yesterday. Sorry for the 
inconvenience.

El viernes, 7 de agosto de 2015, 13:07:49 (UTC+2), Tom Evans escribió:
>
> On Thu, Aug 6, 2015 at 6:55 PM,   
> wrote: 
> > So, I'm trying to use inputs with the hidden attr. I have my form class 
> > (IndexForm) that has this: 
> > field = HiddenInput() 
> > Then, I pass the instance of IndexForm (index_form) to the template, and 
> > manually render the field (index_form.field). It is alright, but then, 
> in 
> > the HTML, the render of the field is this... 
> >  
> > Why I'm seeing the str representation of the object, and not an HTML 
> hidden 
> > input? 
>
> Forms are collections of Field instances, but HiddenInput is a Widget. 
> You should be setting the widget attribute of one of the fields to be 
> a HiddenInput, not assigning a HiddenInput as a member of the form. 
>
> Cheers 
>
> Tom 
>

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/01a874e1-02be-41bd-bdd3-5d630a9d7a30%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Issue when rendering manually a form's HiddenInput

2015-08-07 Thread 'Tom Evans' via Django users
On Thu, Aug 6, 2015 at 6:55 PM,   wrote:
> So, I'm trying to use inputs with the hidden attr. I have my form class
> (IndexForm) that has this:
> field = HiddenInput()
> Then, I pass the instance of IndexForm (index_form) to the template, and
> manually render the field (index_form.field). It is alright, but then, in
> the HTML, the render of the field is this...
> 
> Why I'm seeing the str representation of the object, and not an HTML hidden
> input?

Forms are collections of Field instances, but HiddenInput is a Widget.
You should be setting the widget attribute of one of the fields to be
a HiddenInput, not assigning a HiddenInput as a member of the form.

Cheers

Tom

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFHbX1K9EbUSdHTkQ3V%3D2dTUXj88ubAmgVvun6jDidP32y6%3DZQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.