简体   繁体   中英

How to save data related to two models

I'm learning Django and have I problem, I don't even know what I should search for to solve it. So maybe someone knows what I need.

So far I have two models in my project

  1. CustomUserModel with additional data

  2. RunningTrackModel which provides information about tracks like distance, location, etc.

My goal is now to save user specific Data for each object of the RunnningTrackModel like time, date, etc. Whenever a new RunningTrackObject is created, all users should get the possibility to sign up and save data to tracks they signed up for, but whats the right way to implement this?

  1. save each object into an individual table in a relational database like MySQL

  2. link them using the user ID as a foreign key.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM