[storm] doubt 2

Gustavo Niemeyer gustavo at niemeyer.net
Wed Nov 28 19:20:05 GMT 2007


Hello again,

> class Container(DBObject, InheritableSQLObject):
>     items = RelatedJoin('DBItem', addRemoveName='Item')
>
> i have this (sqlobject)  that make the relation with container and DBitem
> and create addItem, but i dont know how make something to make addItem in
> storm.

You do something like this:

  class Item(Storm):
      ...
      id = Int(primary=True)
      container_id = Int()

  class Container(Storm):
      ...
      id = Int(primary=True)
      items = ReferenceSet(id, Item.container_id)

  container = Container()
  item = Item()
  container.items.add(item)

-- 
Gustavo Niemeyer
http://niemeyer.net



More information about the storm mailing list