Reputation: 1
Given any standard Django models.py
file, how can you tell Django to include / exclude certain models conditionally (e.g. based on variables in the settings.py
module) when running python manage.py makemigrations [app_name]
?
Upvotes: 0
Views: 1315
Reputation: 4171
When running python manage.py makemigrations [app_name]
you cannot exclude certain models. You can write migrations manually, read the documentation: Writing database migrations.
Or run python manage.py makemigrations [app_name]
and then edit the generated migrations file to delete operations that construct models you want to exclude.
Upvotes: 1