Answer the question
In order to leave comments, you need to log in
What is the correct way to generate Django models in this situation?
Good evening! Help with advice on how to correctly form Django models in the project. The essence is the following, I want to create a database of sporting events, let's say football matches. To begin with, I plan to make the following models:
- Season (year)
- Tour (number)
- Match (date, venue, result 1 (team 1), result 2 (team 2))
- Result (home team, away team ( opponent), goals scored, conceded, penalties, corners, etc.)
- Team (name)
The season consists of Tours, Tours of Matches, and each Match of two Results (with indicators for the first and second teams respectively). Confused at this point on how to correctly bind the Match and Result models to each other like OneToOne or better ForeignKey? Or is it generally better to rewrite the models differently?
Initially, I wanted to record all indicators in the Match model, but it seemed to me a very cumbersome solution + in the future I want to make a selection from the results obtained and compile a table on the number of goals scored, goals conceded, etc., to compare the performance of teams in one match or in different ones. Pulling it out of the Match will not be as convenient as from the Result, as it seems to me.
In general, I'm just learning, I would like advice from experienced ...
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question