1đź‘Ť
Django seems to do one DB table per model
Actually you’d better think about it the other way round : a Django “Model” is the representation of one DB table.
But I think that means all of the registrations for every race (via a
foreign key) will be in it…one table for all of them. Maybe it’s not
that many, but it seems messy and unclean to have all registrations
for all of the races in one table.
Why ???
Races on average have about 500 people, some can be a couple thousand.
SQL Databases are designed to work on much bigger datasets – think millions of rows and more. With 2000 registrations per race and a few races per year you shouldn’t have to worry too much. Now if you have peoples registering for more than one race, you’d be better with three tables:
- race(race_id, name, date, ….)
- person(person_id, firstname, lastname, …)
- registration(race_id, person_id, ….)
with a unique constraint on (registration.race_id, registratio.person_id).
From your question I assume you have very few knowledge – if any – or relational databases, so I strongly suggest you take some times learning about proper relational databases modeling.