oops, did not use form_for_instance(d).
However, is_valid is not telling me that the form is correct.
What am I doing wrong?

>>> d = Person.objects.get(id=1)
>>> p = forms.models.form_for_instance(d)
>>> f=p()
>>> print f
<tr><th><label for="id_name">Name:</label></th><td><input id="id_name"
type="text" name="name" value="My name" maxlength="200" /></td></tr>
<tr><th><label for="id_country">Country:</label></th><td><select
name="country" id="id_country">
<option value="">---------</option>
<option value="1" selected="selected">USA</option>
<option value="2">Netherlands</option>
</select></td></tr>
<tr><th><label for="id_addr1">Addr1:</label></th><td><input
id="id_addr1" type="text" name="addr1" value="my address"
maxlength="200" /></td></tr>
<tr><th><label for="id_addr2">Addr2:</label></th><td><input
id="id_addr2" type="text" name="addr2" value="my address 2"
maxlength="200" /></td></tr>
<tr><th><label for="id_addr3">Addr3:</label></th><td><input
id="id_addr3" type="text" name="addr3" value="my address 3"
maxlength="200" /></td></tr>
<tr><th><label for="id_addr4">Addr4:</label></th><td><input
id="id_addr4" type="text" name="addr4" value="MY ADDRESS 4"
maxlength="200" /></td></tr>




On May 1, 10:10 pm, maeck <[EMAIL PROTECTED]> wrote:
> I am confused about the following:
> If I get a previous saved record, transform it into a form instance
> and then create a form out of it, the data is not valid nor bound (see
> below). However, if I print out the form, all fields are populated
> correctly.
> Am I missing a step?
>
> Thanks, Marcel
>
> >>> d = Person.objects.get(id=1)
> >>> p = forms.models.form_for_model(d)
> >>> f=p()
> >>> f.is_valid()
> False
> >>> f.is_bound
> False
> >>> print f
>
> <tr><th><label for="id_name">Name:</label></th><td><input id="id_name"
> type="text" name="name" maxlength="200" /></td></tr>
> <tr><th><label for="id_country">Country:</label></th><td><select
> name="country" id="id_country">
> <option value="" selected="selected">---------</option>
> <option value="1">USA</option>
> <option value="2">Netherlands</option>
> </select></td></tr>
> <tr><th><label for="id_addr1">Addr1:</label></th><td><input
> id="id_addr1" type="text" name="addr1" maxlength="200" /></td></tr>
> <tr><th><label for="id_addr2">Addr2:</label></th><td><input
> id="id_addr2" type="text" name="addr2" maxlength="200" /></td></tr>
> <tr><th><label for="id_addr3">Addr3:</label></th><td><input
> id="id_addr3" type="text" name="addr3" maxlength="200" /></td></tr>
> <tr><th><label for="id_addr4">Addr4:</label></th><td><input
> id="id_addr4" type="text" name="addr4" maxlength="200" /></td></tr>
>
>


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to