Clear as mud.  Where does it show how I update two objects in one form?

On Dec 19, 2009, at 1:16 PM, Antoni Aloy wrote:

> 2009/12/19 Todd Blanchard <tblanch...@mac.com>:
>> How does this solve the problem of having two related objects that have the
>> same attribute name (like "name") on the same html form?  As I see it, it
>> doesn't.  There will be a conflict and it will be impossible to keep them
>> separate.
>> IOW,
>> <form ... >
>> {{ account_form }}
>> {{ contact_form }}
>> <input type="submit">
>> </form>
>> def update_account_and_contact
>> if(request.POST)
>> account_form = AccountForm(request.POST, instance=get_object_or_404(Account,
>> id=request.POST['id'])
>> contact_form = ContactForm(request.POST, instance=get_object_or_404(Contact,
>> id=request.POST['id'])
>> if(account_form.is_valid() && contact_form.is_valid())
>> account_form.save()
>> contact_form.save()
>> .....
>> 
>> The rails solution is much superior.
>> 
> 
> Thi is clearly explained in the Django documentation about forms
> http://docs.djangoproject.com/en/dev/ref/forms/api/#ref-forms-api
> 
> Django documentation us much superior :-P
> 
> 
> -- 
> Antoni Aloy López
> Blog: http://trespams.com
> Site: http://apsl.net
> 
> --
> 
> 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.
> 
> 

--

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.


Reply via email to