Friday, July 24, 2015

Re: Migrate a many-to-many field to an explicit intermediate ("through") model?

Hi all,

just wanted to let you know that I was successful!

I followed Gergely's final recipe, using RunPython for the data migrations and separate
migration files for each of the steps.

For step 3 (the deletion of the ManyToManyField) I temporarily had to remove the
django.contrib.admin from the INSTALLED_APPS, because I was referring to the old
ManyToManyField in my app's admin.py setup, which in turn was processed while running
`./manage.py makemigrations`.

Overall, this worked very well.

Many thanks to you both for your help!
:-)

Am 23.07.2015 um 22:37 schrieb Carl Meyer:
>> Meanwhile it might worth a question to the devs (or a more thorough
>> search on the topic) to understand why you can't switch from a simple
>> m2m field to one with a through option.
>
> Just because it's a bit complex to implement, and nobody has implemented
> it yet.

Well, if I understand this correctly, https://code.djangoproject.com/ticket/23034 has a
reviewed PR that implements this, but unfortunately the original author has not updated
the PR for several months...

Best regards,
Carsten

--
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/55B2814E.1090604%40cafu.de.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment