Hello,

I was having the same issue as Torsten: it does not appear to be possible 
to load initial data related to contenttypes or auth during migrations.

As for the problem with contenttypes reported by Torsten, a workaround 
appears to be calling `update_all_contenttypes` manually from your 
migration (from django.contrib.contenttypes.management).

But then there's the problem with creating auth.groups.

I've tried the following via `RunPython`:

    from django.contrib.auth.management import create_permissions
    create_permissions(apps.get_app_config('auth'), verbosity=0)

This aborts because `app_config.models_module` is None:

    app_config.__dict__
    {'models_module': None, 'name': 'auth', 'models': 
OrderedDict([('group_permissions', <class 'Group_permissions'>), ...]), 
'module': None, 'label': 'auth', 'verbose_name': 'Auth'}

Is this related to https://code.djangoproject.com/ticket/23822 ("Serialize 
model managers in migrations"), and would be possible in Django 1.8?

I am trying to use https://github.com/alexhayes/django-migration-fixture, 
which is meant to provide a convenient wrapper around the initial_data 
fixtures (files). My PR with the changes mentioned above is viewable at: 
https://github.com/alexhayes/django-migration-fixture/pull/2/files.

What is the suggested way to have initial data with Django 1.7, given that 
initial_data is not used for apps with migrations, and RunPython has the 
above shortcomings?


Thanks,
Daniel.

Am Dienstag, 21. Oktober 2014 19:42:34 UTC+2 schrieb Torsten Bronger:
>
> Hallöchen! 
>
> Markus Holtermann writes: 
>
> > Are you talking about Django 1.7 migrations or South? In the 
> > former case you need to make sure that your datamigration depends 
> > on the contenttypes application. 
>
> I'm talking about Django 1.7 migrations.  Unfortunately, 
> contenttypes is already migrated before my app.  But this doesn't 
> help because update_all_contenttypes is a post_migrate signal. 
>
> Tschö, 
> Torsten. 
>
> -- 
> Torsten Bronger    Jabber ID: torsten...@jabber.rwth-aachen.de 
> <javascript:> 
>                                   or http://bronger-jmp.appspot.com 
>
>

-- 
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/ea94baae-d353-4f61-8b79-44092d91fdfd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to