I am trying to do something really simple and I am sure there are 10 ways to do it but I can't seem to find one. I just want to include a method in one class to create a new object in another class. So I have a people class with a foreign key field to a group class. I made some methods to get_related : get all the people in the persons group and rem_related : remove people from a persons group and add_related: add people to a persons group,
but when I try to put a check into add_related that says to create a new group if the person doesn't yet have one (by using g=group.Group(name='x') g.save() it tells me that global name groups is not defined, despite having defined Group class right above People class, and despite the fact that g=group.Group(name='x') works in the python command line. I thought maybe I was supposed to use a manipulator object instead but thats not clear and seems unnecessary, or maybe somehow tell People that Group is defined right above it, but thats not indicated anywhere either. Does anyone have any idea whats wrong?

