33 ms·
I think this is a great resource. The only comment I have is on the Thin Views chapter. Instead of attaching logic to the models, I like to make a services.py f
by willmeyers 3y ago
I think this is a great resource. The only comment I have is on the Thin Views chapter. Instead of attaching logic to the models, I like to make a services.py file in my app that has functions that satisfy all sorts of business logic that I can plop in anywhere I need them.
Here's another opinionated Django guide: https://github.com/HackSoftware/Django-Styleguide https://github.com/HackSoftware/Django-Styleguide if anyone's interested
- noisy_boy 3y agoThis is how I do things in Spring Boot too. Model specific stuff stays in the model, cross model business logic goes into services.
- kisamoto 3y agoHaving worked on Django projects of multiple sizes I really like the HackSoftware Django Styleguide. It was a refreshing approach rather than tracking down logic scattered between models, views, managers etc. For very simple projects it can add a bit of bloat/boilerplate but as complexity grows it's great to have reusable selectors & service functions to use.