Hacker News new | ask | show | jobs
by gedrap 3733 days ago
It depends on the project.

If you have a small number of models (e.g. <= 5), then it's fine to have them all in one file, as you will not benefit from multiple files, really.

When your application is growing, you have split the models into multiple files, grouped by features, etc (e.g. users.py, content.py, etc).

I prefer this as models usually a very small, and switching from one file to another can become quickly annoying when working on related models. However, it may be different for large classes.