Re: How set initial form field value in the view function?

2010-07-04 Thread Jim
> The initial keyword is great when defining a subclass of Form if you
> the initial values is ALWAYS the same.
>
> What if it varies?...I'm guessing I must set it in the view.

From:
  http://docs.djangoproject.com/en/1.2/ref/forms/api/#dynamic-initial-values
we have:
  Dynamic initial values¶
  Form.initial
  Use initial to declare the initial value of form fields at runtime.
For example, you might want to fill in a username field with the
username of the current session.

Possibly you could restate your requirement?  At least I'm not seeing
why
  fm(initial={'x':variable_name})
won't help you.

Or possibly you want to override the __init__ method of the form?

Jim

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



How set initial form field value in the view function?

2010-07-04 Thread Chris Seberino
How set initial form field value in the view function?

The initial keyword is great when defining a subclass of Form if you
the initial values is ALWAYS the same.

What if it varies?...I'm guessing I must set it in the view.

How set this initial value in the view?

Chris

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