Saturday, September 27, 2014

Re: Upgrading Django (to 1.7)

Hi Bob,
Thank you!

I spend a lot of Part II talking about schema and data migrations in both South and native Django 1.7 migrations. When building data migrations, you should be using historical models. In Django 1.7, you can request these models directly from the app registry built on the fly by the migration system and passed to the methods specified in the `RunPython` operation. This avoids using the models as they exist in the `` file. This is similar to South's requirement you use the `orm` variable to interact with models, as Fred mentions.

If you would like more depth on the topic, then Part II is for you. If you would like to explore the topic before Wednesday, this is material available in the video. The code in the slides and github repo may be quite helpful as well.

Data migrations and schema migrations should play very well with each other. As I mentioned to Sabine, the only instance I had any difficulty was when I squashed migrations. As I had been alternating systematically between schema migrations and data migrations, the automatic squash tool was unhelpful. Thankfully, as the migration files are now easy to edit, I had absolutely no issue modifying the squash migration file myself.

Unfortunately, I do not go into detail about this in the article. Hopefully, the number of times we directly modify the migration files will allow people to figure this out for themselves. If that is not the case, and enough people ask, I will happily write a short article about the process.

If you have any questions about data migrations after reading Part II, please ask them here!


You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
To view this discussion on the web visit
For more options, visit

No comments:

Post a Comment