Re: Populating Django app db with JSON data

2015-03-06 Thread Collin Anderson
Hi Sandeep, A snapshot (or at least a diff from the previous one) is stored when you run makemigrations. Collin On Wednesday, March 4, 2015 at 2:15:41 PM UTC-5, Murthy Sandeep wrote: > > Hi > > thanks for the info. > > The docs also say that RunPython runs “custom Python code > in a historic

Re: Populating Django app db with JSON data

2015-03-04 Thread Murthy Sandeep
Hi thanks for the info. The docs also say that RunPython runs “custom Python code in a historical context”. What does that mean exactly? It seems related to the apps and schema_editor arguments passed to the custom method that will be called by RunPython - is this something like a snapshot of t

Re: Populating Django app db with JSON data

2015-03-02 Thread aRkadeFR
“custom Python code in a historical context” FMPOV, it means that your code will be run exactly at a certain schema of your DB. If your migration is the 3rd one, it will always be run after your first two migrations, thus you will know exactly your schema. The schema is passed to your function (a

Re: Populating Django app db with JSON data

2015-03-02 Thread aRkadeFR
Hello, Indeed, the data migration is the best way. Check out the documentation here: https://docs.djangoproject.com/en/1.7/ref/migration-operations/#django.db.migrations.operations.RunPython You write your function that will be called by the RunPython and will load your JSON. Migration are order