PigletWatcher schrieb:
> I modified Models like this:
> 
> class Order(SQLObject):
>     name = StringCol()
>     createTime = DateTimeCol()
>     items = MultipleJoin('OrderItem')
> 
> 
> class OrderItem(SQLObject):
>     topic = StringCol()
>     groups = ForeignKey('Order')

Why do you call the Order "groups"?

>     createTime = DateTimeCol()
> 
> But it still doesn't work. "parent" property is defined in
> "OrderItemField"

You refer to the parent as

self.parent

in the controller. That doesn't work, because it's global state. You 
must provide the parent-id using a hidden formfield in the child form.

> After define it well, do i need to append extra code in the
> OrderItemController when creation of "OrderItem" or SQLite will pick
> up the work to build the one-to-many connection automatically?

I don't fully understand this, but all you should need to do is

OrderItem(topic=topic, groups=the_order, createTime=datetime.datetime.now())

How about you first write some sqlobject-code that works, toying around 
with your model (e.g. by writing unit-tests) before you start working on 
the controllers?


Diez

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to