I am having trouble finding a good tutorial on how to identify the basic foreign key relationships between models. Suppose I have a user model and a game model.
I would like to define two fields in the Game model: host_id and visitor_id, which map to the relation of the foreign key to the user model. The identifiers of the βhostβ and βvisitorβ fields of the βGameβ class basically determine the two players who will participate in the peer-to-peer game ... and these fields must be mapped to the actual users of the application, as defined in the User model by the user ID.
Thanks!
source share