Google app engine ReferenceProperty relationships

前端 未结 4 1269
别那么骄傲
别那么骄傲 2021-01-07 07:39

I\'m trying to get my models related using ReferenceProperty, but not have a huge amount of luck. I have 3 levels: Group, Topic, then Pros, and Cons. As in a Group houses ma

4条回答
  •  春和景丽
    2021-01-07 08:12

    Just to answer the question for others as you probably figured this out:

    class NewTopic(webapp.RequestHandler):
        def get(self):
          groupId = self.request.get('group')
          # either get the actual group object from the DB and initialize topic with topic_group=object as in 'Nick Johnson's answer, or do as follows
          topic = Topic()
          topic.name = self.request.get("topicname")
          topic.reference = groupId
          topic.put()
    

提交回复
热议问题