Re: Newforms and hidden fields

2007-01-10 Thread [EMAIL PROTECTED]
Thanks for the quick implementation. I've played around with it a bit already and it works as expected. Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, se

Re: Newforms and hidden fields

2007-01-08 Thread Adrian Holovaty
On 1/6/07, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: On 1/6/07, Adrian Holovaty <[EMAIL PROTECTED]> wrote: > # Unbound form with dynamic initial data > f = MyForm(initial={'foo': 'initial value'}) > > # Bound form with dynamic initial data > f = MyForm({'foo': 'bar'}, initia

Re: Newforms and hidden fields

2007-01-06 Thread Ville Säävuori
I'm trying to convert my user registration forms to newforms and this was my first glitch with them. My scenario is this: user submits username + email, which are hashed and validation email is sent to user. (Nothing is saved to db at this point.) User comes back with the hash, which is then de-

Re: Newforms and hidden fields

2007-01-06 Thread [EMAIL PROTECTED]
I agree with Russ. Either way works for me & as far as throwing an exception, I don't really care either way either. I guess I'm not really much help am I ;) -Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: Newforms and hidden fields

2007-01-06 Thread Russell Keith-Magee
On 1/6/07, Adrian Holovaty <[EMAIL PROTECTED]> wrote: # Unbound form with dynamic initial data f = MyForm(initial={'foo': 'initial value'}) # Bound form with dynamic initial data f = MyForm({'foo': 'bar'}, initial={'foo': 'initial value'}) In the last case, the initial paramet

Re: Newforms and hidden fields

2007-01-05 Thread Adrian Holovaty
On 1/5/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: For a contact form, I think it would be a common use-case that you would want to pre-populate name and email address if you were registered. In fact, I'm trying to do this right now and don't see an easy way to do it without subclassing t

Re: Newforms and hidden fields

2007-01-05 Thread [EMAIL PROTECTED]
Ooops. I see that Russell beat me to the punch. Either way it's good to see that we both came up with similar approaches to solving the problem. Surely that counts for something ;) -Chris --~--~-~--~~~---~--~~ You received this message because you are subscri

Re: Newforms and hidden fields

2007-01-05 Thread Russell Keith-Magee
On 1/6/07, Adrian Holovaty <[EMAIL PROTECTED]> wrote: On 1/5/07, Honza Král <[EMAIL PROTECTED]> wrote: > see the 'initial' parameter for field... > it is failry new, so you might want to run svn up... Yes, and I just added documentation for that feature last night: http://www.djangoprojec

Re: Newforms and hidden fields

2007-01-05 Thread [EMAIL PROTECTED]
If Waylan's approach is incorrect, then what would be the preferred manner to pre-populate dynamic data? For a contact form, I think it would be a common use-case that you would want to pre-populate name and email address if you were registered. In fact, I'm trying to do this right now and don'

Re: Newforms and hidden fields

2007-01-05 Thread Waylan Limberg
On 1/5/07, Waylan Limberg <[EMAIL PROTECTED]> wrote: Prior to `initial` being available, I created a static (although is could be a dynamically populated) dict, and passed that in when initializing a blank form. Being I never validated the form, no errors appeared. So that is another option. I

Re: Newforms and hidden fields

2007-01-05 Thread Adrian Holovaty
On 1/5/07, Waylan Limberg <[EMAIL PROTECTED]> wrote: > The immediate use case for me is hidden fields. The user can't fill in > a hidden field, so this data must come from the form initialization; > but if you provide a sparse data set on initialization, the first > presentation of the form will

Re: Newforms and hidden fields

2007-01-05 Thread Waylan Limberg
On 1/5/07, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: Hi All, I've been using newforms in anger recently, and I've hit a bit of a hurdle. There might be an obvious way around this, but I can't see it. If you define a form, you can instantiate it with no data, or you can instantiate it wit

Re: Newforms and hidden fields

2007-01-05 Thread Adrian Holovaty
On 1/5/07, Honza Král <[EMAIL PROTECTED]> wrote: see the 'initial' parameter for field... it is failry new, so you might want to run svn up... Yes, and I just added documentation for that feature last night: http://www.djangoproject.com/documentation/newforms/#initial Adrian -- Adrian Ho

Re: Newforms and hidden fields

2007-01-05 Thread Honza Král
see the 'initial' parameter for field... it is failry new, so you might want to run svn up... On 1/6/07, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: Hi All, I've been using newforms in anger recently, and I've hit a bit of a hurdle. There might be an obvious way around this, but I can't see

Newforms and hidden fields

2007-01-05 Thread Russell Keith-Magee
Hi All, I've been using newforms in anger recently, and I've hit a bit of a hurdle. There might be an obvious way around this, but I can't see it. If you define a form, you can instantiate it with no data, or you can instantiate it with complete data (binding the form). However, what if you onl