Re: retrieving initial form data

2007-10-18 Thread Ken

Thanks!  Exactly what I needed.  I subsequently found it in newforms/
forms.py.   Duh!  I think my eyes just glazed over when I saw all that
complicated new-style Python class stuff.


On Oct 17, 1:10 pm, Doug B <[EMAIL PROTECTED]> wrote:
> The bound data and initial data dicts are just set on the form
> instance as form.data, and form.initial.  This isn't 'clean' data
> though, so you are bypassing any newforms validation.
>
> a = AForm( initial = {'x': 1} )
> a.initial['x']


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: retrieving initial form data

2007-10-17 Thread Doug B

The bound data and initial data dicts are just set on the form
instance as form.data, and form.initial.  This isn't 'clean' data
though, so you are bypassing any newforms validation.

a = AForm( initial = {'x': 1} )
a.initial['x']


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



retrieving initial form data

2007-10-17 Thread Ken

Given an instance of a form that was created with initial data, how do
I extract a specific field value?  For example,

a = AForm( initial = {'x': 1} )

How do I find out what value the field named 'x' is?

a.fields['x']

gives me 

a.fields['x'].initial

returns None

I am not interested in submitted values that may be bound to the
form.  The field is a hidden input field which I am using to index
pieces of the form that is rendered.

Thanks!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---