def post(self, **kwargs): new_member = self.db.query(User).get(self.request_json['member_id']) if not new_member: raise local_exc.UserNotExistError membership = Membership(member=new_member, circle=self.query_circle) membership.status = consts.WATING_ACCEPT self.db.add(membership) self.db.commit() self.write(membership.json)
def post(self): name = self.request_json['name'] description = self.request_json['description'] circle = Circle(name=name, description=description) self.db.add(circle) membership = Membership(member=self.current_user, circle=circle) membership.status = consts.ACCEPTED self.db.add(membership) self.write(circle.json) self.db.commit()