On Wed, Nov 18, 2009 at 2:01 AM, Ilya Polosuhin <ilblackdra...@gmail.com>wrote:

> Just use "initial" keyword on creation form
> class myForm(forms.Form):
>     test = forms.CharField(label = _('test'), max_length=255, required =
> True)
> ....
> myForm(initial = {'test': 'test string'}).
>
> If you use form that generated from model:
> class myForm(forms.Form):
>
>   class Meta:
>     model = myModel
> ...
> myForm(initial = myModel(var1 = 'qq' ))
>

Ah, that last way of doing it is the one that I couldn't find.

Meanwhile, I kludged it by using a loop to generate the choices and "ifequal
choice.id selected_project"  to insert the "checked" attribute into the
appropriate choice, which works.

Nice to know the right way, however.  Thanks

Nick

--

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=.


Reply via email to