Create smaller files by splitting them
Today the files are getting a bit too huge especially some models). It would be better to split them. The first idea I have in mind is by making 1 file = 1 class. But since Django needs the models and forms and views and urls modules to exist, there may be one solution.
Here is an example on users app (trailing /
means it's a directory not a file) :
users/
|- acl.py
|- admin.py
|- forms/
| |- __init__.py (contains the import of other modules)
| |- form1.py
| |- form2.py
| |- ...
|- __init__.py
|- management/
| |- commands/
| | |- chssh.py
| | |- derniere_connexion.py
| | |- email.py
| | |- ldap_sync.py
|- migrations/
| |- migration1.py
| |- ...
|- models/
| |- __init__.py (contains the import of other modules)
| |- model1.py
| |- model2.py
| |- ...
|- serializers/
| |- __init__.py (contains the import of other modules)
| |- serializer1.py
| |- serializer2.py
| |- ...
|- templates/
| |- users/
| | |- template1.html
| | |- template2.html
| | |- ...
|- tests.py
|- urls.py
|- views/
| |- __init__.py (contains the import of other modules)
| |- view1.py
| |- view2.py
| |- ...
So as you can see my idea is to have packages instead of modules but use the init.py to fake it like a module.