Split your Django generated models into separated files

github logo ・1 min read

Split Django Models

Split Django generated models into separated files, with proper names, classes and imports.


Generate your models:

python3 manage.py inspectdb > models.py

Run the script:

./split_django_models.sh models.py

Put them all into a folder so you can enjoy the step bellow:

The script also creates a __init__.py file, so you can import them all at once:

from yourapp.models import *

Get the script here

twitter logo DISCUSS
Classic DEV Post from Sep 22 '18

How to Improve Your Development Experience

To become a better developer, you need to think beyond coding speed. You need to improve not only your core skills but also the physical environment, tooling and your approach to problem-solving.

Victor Ribeiro profile image
Software Engineering student, one year to go!