Tuesday, October 21, 2014

Re: Data migration fails because contenttypes not yet ready

Hey Torsten,

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.

If you use South: yes, calling update_all_contenttypes seems to be a
valid solution.

Best,

Markus

On Tue, Oct 21, 2014 at 06:40:43PM +0200, Torsten Bronger wrote:
>Hallöchen!
>
>I want to implement an initial data migration (basically, the same
>thing initial_data.json used to do). The problem is that my initial
>data must be connected with ContentType instances. However,
>update_all_contenttypes() hasn't been called at this stage, so my
>migration fails.
>
>As far as I can see, update_all_contenttypes is idempotent. Can I
>safely call update_all_contenttypes during the data migration? I
>wonder whether the models may be available in an older version, and
>whether this may confuse update_all_contenttypes.
>
>That said, it *seems* to work ...
>
>Tschö,
>Torsten.
>
>--
>Torsten Bronger Jabber ID: torsten.bronger@jabber.rwth-aachen.de
> 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+unsubscribe@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/87tx2x9y0k.fsf%40physik.rwth-aachen.de.
>For more options, visit https://groups.google.com/d/optout.

--

No comments:

Post a Comment