How to structure complex Django project?
I find refactoring can really help. Are there a lot of similar views that just have different templates or querysets? Make a more generic view that accepts multiple template names, records, etc.
Anything that requires extensive calculations gets moved to a utils.py in the same directory.
Class methods are for actions that affect a single record; managers are for dealing with filtering records or creating a record.
If you're already taking the step of making separate models, views, etc. folders and breaking views and models into separate files, that suggests to me that you could separate them out into separate apps. I like that as an option much better.
I have a Django project which is getting more and more complex. I started off with the traditional files: models, views, and forms.py. The issue I have right now is that those files are getting bigger and bigger and I'd like to break them into manageable parts. What are the best practices around that?
In addition, I am wondering if it is best practice to add class method to a model in Django? For instance, I have a Vote class on which I would like to add methods to get the number of votes for a specific user, content, etc?