Dave Perrett

Splitting Up Django Models

django, linux, programming, python, quickie

  1. Create a models folder under myApp.
  2. Delete models.py and add a model_name.py file in the models folder for each model model_name.
  3. Add the following to each model file :
1
2
class Meta:
  app_label = 'myApp'
  1. Add a line in models/init.py for each model file :
1
from myModelFile import myModel

More information at djangoproject.com