Leonard, try that.

http://stackoverflow.com/questions/25960850/loading-initial-data-with-django-1-7-and-data-migrations


Att,
Andre Manzano

--------


Em terça-feira, 11 de novembro de 2014 13h36min14s UTC-2, Leonard Wayne 
escreveu:
>
> Fred,
>
> Got it!!  Thank you!!
>
> - Leonard
>
> On Sunday, November 9, 2014 5:46:30 PM UTC-5, Leonard Wayne wrote:
>>
>> I am in the process of upgrading from
>> Django 1.6 to 1.7.
>>
>> I have three fixtures.  I am trying to figure
>> out how I should load them.
>>
>> One fixture is `initial_data.json`, and I know
>> that starting with Django 1.7 this special
>> fixture no longer gets automatically loaded
>> as it did when we used to run `syncdb` (i.e.,
>> prior to deprecation in Django 1.7).
>>
>> So I know all three fixtures should be loaded
>> the same way as each other, whatever way that
>> may be.
>>
>> My main question is:
>>
>> Should I keep using `loaddata`, as in:
>>
>>     python manage.py loaddata <fixture>.json
>>
>> Reading the documentation I get the sense
>> (though I am not sure) that now the preferred
>> approach to load fixtures is to create a
>> migration to perform the loading.  But I
>> don't see an example of how to do this
>> process from beginning to end.  It looks
>> like the process starts with creating an
>> empty migration, then manually editing the
>> migration file to define a function like:
>>
>>     def load_data(apps, schema_editor):
>>
>> But I don't know how to write this function
>> (`load_data`), and I can't find an example.
>>
>

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/539e3fb7-f699-45c1-bb19-a814aa7231c1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to