The two models look like this:

class Order(SQLObject):
    name = StringCol()
    createTime = DateTimeCol()
    items = RelatedJoin('OrderItem')

class OrderItem(SQLObject):
    topic = StringCol()
    groups = RelatedJoin('Order')
    createTime = DateTimeCol()

On Oct 23, 7:44 pm, Diez Roggisch <[EMAIL PROTECTED]> wrote:
> How does your model look?
>
> Diez
>
> -----Ursprüngliche Nachricht-----
> Von: "PigletWatcher" <[EMAIL PROTECTED]>
> Gesendet: 23.10.08 23:41:04
> An: TurboGears <[email protected]>
> Betreff: [TurboGears] Look out for help about one-to-many question
>
> I defined one-to-many relation between two models : Order and
> OrderItem.
>
> In OrderItem Controller:
>
> @expose(template='kid:elitesocial.OrderItemController.templates.form')
>     def new(self, **kw):
>         """Create new records in model"""
>         order = Order.get(self.parent)
>
>         order.items.add(newParty)
>         return dict(modelname = self.modelname, form = model_form,
> page='new')\
>
> class OrderItemFields(widgets.WidgetsList):
>     """fields definitions. Replace to your Fields"""
>     itemName = widgets.TextField(name='itemName', label='Item
> Name')
>     parent = widgets.TextField()
>
> Now I'm hoping to build the one-to-many relationship when creation of
> OrderItem, but it throws erroe message inside of "new" method., saying
> that 'OrderItemController' object has no attribute 'parent'
>
> How can I buid the one-to-many connection when creation of OrderItem?
> Please do me a favor, i'm haning here.
>
> _____________________________________________________________________
> Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu 
> sparen!http://smartsurfer.web.de/?mc=100071&distributionid=000000000066
--~--~---------~--~----~------------~-------~--~----~
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