Thanks so much for this. I'm getting my head around this slowly.

Got the create stuff working now.

class Person(SQLObject):
  name = StringCol(length=255)
  friends =
RelatedJoin('Person',joinColumn='p1',otherColumn='p2',addRemoveName='Person')


But still can't work out how to select people who are friends of
someone

something like this
SELECT p.person_id, p.person_name, count(r.mod_id) c  FROM person p,
friend r WHERE p.person_id = r.friend_id GROUP BY r.friend_id ORDER BY
p.person_i
nsert_date

Got as far as

    @turbogears.expose()
    def sources (self):
      return dict(selectID='friends',
                  options=[{'label':p.name,
                            'value':p.id}
                            for p in model.Person.select()])

Which isn't far at all!

  .M.

Reply via email to