I implement one-to-many relationship between Order and OrderItem
models.

in the OrderController.py

@expose(template='kid:test.OrderController.templates.show')
    def show(self,id, **kw):
        """Show record in model"""
        record = Order.get(int(id))
        orderItems = NetworkGroup.all_related_orderItems(id)
        return dict(record = record, orderItems=orderItems)

in the Order class in  model.py:

def all_related_orderItems(self,id):
        return [orderItem for orderItem in self.orderItems
                if (orderItem.groupID == id)]

but when browsing to http://localhost:8080/Orders/show/1

It throws the message that unbound method all_related_orderItems()
must be called with Order instance as first argument.

Thanks, i'm nascent in python.

On Oct 21, 11:48 am, Christopher Arndt <[EMAIL PROTECTED]> wrote:
> PigletWatcher schrieb:
>
> > In the one-to-many relationship scenario,  I've defined the
> > relationship among models, now how to display the related "child
> > model" on the "show" form of "parent" model?
>
> Hello PigletWatcher,
>
> I have now tried several times to give you hints that you need to
> provide more information, if we should be able to help you.
>
> Please take my advice and read the following article and then try to
> post again following the advice in this article:
>
>    http://catb.org/~esr/faqs/smart-questions.html
>
> And no, posting the same question again (only slightly rephrased) won't
> help!
>
> Chris
--~--~---------~--~----~------------~-------~--~----~
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