python - about one to many relationship in datastore and dereferncing in google app engine? -


I have many connections between two entities, the first of which is the satellite and the other channel and the form of satellite is a satellite name Which I want to show in another HTML page with channel data, where you can say that this channel is related to the satellite that can be made

Use this reference property to It looks like a good case, which is part of the App Engine's Datastore API. Here's an idea to get started:

  class satellite (db.Model): name = db.StringProperty () class channel (db.Model): satellite = db.ReferenceProperty (Satellite, With this you can assign such a channel to:  
  my_sat = Satellite (name = 'channel') freq = db.StringProperty ()  

'SatCOM1') My_sat.put () channel (satellite = my_sat, freq = '28. 1200hz '). Put () ... # Add another channel ...

Then loop through the channel is a given Satellite object:

Priority: my_sat In Channels: Print 'Channel Frequency:% s'% (chan.freq)

Anyway, it tells about the model unit's relationships in the app engine that it is too much. Hope this helps.


Comments