So, I am wondering that how to define the order of the columns in Model so that when Django does forward engineering to generate database, the order of columns in the physical database table can be determined by the Model itself?
Currently some of my model classes inhering from other model class, so the derived model class always put the columns from the parent class first, but I want to control that.
Thanks
On Django 1.8 this worked for me:
./manage.py makemigrations
fields
list on migrations.CreateModel
.I did not test this with inheritance though.
Currently, there's no built-in way to do this in Django.
I seem to remember a django-dev thread/ticket that discussed this, but I can't see to find it at the moment. I'll update this if I find it (and welcome anyone else to if they do.)
There's probably a way to hack this into the core if you really need it that bad.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With