That is *not* a one-to-many-relation. It's a many-to-many relation. And where do you get the idea from that there is a "parent" property? There is none declared.
Please take a good lok at the sqlobject tutorial and enhance your model accordingly. Diez -----Ursprüngliche Nachricht----- Von: "PigletWatcher" <[EMAIL PROTECTED]> Gesendet: 23.10.08 23:59:21 An: TurboGears <[email protected]> Betreff: [TurboGears] Re: Look out for help about one-to-many question 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 ________________________________________________________________________ Schon gehört? Bei WEB.DE gibt' s viele kostenlose Spiele: http://games.entertainment.web.de/de/entertainment/games/free/index.html --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

