Hacker News new | comments | show | ask | jobs | submit login

I've seen a couple of articles that have suggested both "don't use the orm" and "load fixtures using loaddata in your datamigration". These things contradict each other. loaddata uses your models, which will be potentially out of date. We have had to manually load up the fixture using json.loads, then create the model instances using orm.Foo and setattr.

Also, not a great solution, but we monkeypatched south to simply use the number in the file name, ie 0001.py. This way if two developers try to commit a migration, they cause a conflict, and we can fix it then instead of finding out later. It makes the filename less friendly, but we usually use grep/ack to find a migration anyways.

This is actually a really good point and a glaring oversight on my part, I'll have to edit that part of the post.

[Update: I've changed the last paragraph of the article to reference your comment and this solution]

I think the solution is to create a version of loaddata that knows how to work with South's frozen ORM. A quick search turned this up: http://stackoverflow.com/questions/5472925/django-loading-da...

Another approach is to use dumpscript from django-command-extensions and then search-and-replace to use orm instead of your own models.


Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact