Google app engine ReferenceProperty relationships

前端 未结 4 1280
别那么骄傲
别那么骄傲 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:22

    Thankyou for the reply.

    Yeah I am aware of the get vs post. The class I posted was just to actually print all the Groups().

    The issue I have is I'm unsure how I use the models to keep data in a sort of hierarchical fashion, with Groups > Topics > Pros/Cons.

    Grabbing data is simple enough and I am using:

    class NewGroupSubmit(webapp.RequestHandler):
        def post(self):
    
            group = Groups()
            if users.get_current_user():
                group.group_user = users.get_current_user()     
            group.group_name = self.request.get('groupname')
    
            group.put()
            self.redirect('/summary')
    

    I need another function to add a new topic, that stores it within that group. So lets say a group is "Cars" for instance; the topics might be "Ferrari", "Porsche", "BMW", and then pros/cons for each topic. I realise I'm being a little vague, but it's because I'm very new to relational databasing and not quite used to the terminology.

提交回复
热议问题