On 8/4/06, Ian Clelland <[EMAIL PROTECTED]> wrote:
>
> On 8/3/06, cyberco <[EMAIL PROTECTED]> wrote:
> >
> > OK, but what to do with the following in case of 2 models:
> >
>
> In the past, I've made a custom manipulator in situations like this.
> Something like this (WARNING: Untested code ahead!) might work for
> you:
>
> class CustomManipulator(forms.manipulator):
>     def __init__(self):
>         self.fields = (
>             forms.TextField(field_name="text_a"),
>             forms.TextField(field_name="text_b"),
>         )
>
>     def save(self, new_data):
>         # there should probably be some error checking in here somewhere :)
>         new_a = A(text=new_data["text_a"])
>         new_a.save()
>         new_b = B(text=new_data["text_b"], a=new_a)
>         new_b.save()
>
>
> You can use this manipulator just like you use the automatic
> AddManipulator above; the only difference is that it doesn't return an
> instance of A -- although you could certainly make it do that.
>
> Ian Clelland
> <[EMAIL PROTECTED]>
>
Right, and I think these things indeed need custom manipulator.

-- 
I like python!
My Blog: http://www.donews.net/limodou
My Django Site: http://www.djangocn.org
NewEdit Maillist: http://groups.google.com/group/NewEdit

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

Reply via email to