Hello,
I'm sorry, I was not around my mailbox lately.
Yes, you are right, my attempt is not the solution to your problem; it seems that this m2m field really cannot be modified like this. With some slight modifications, though, it may be.
1) create the through table
2) migrate data with RunPython — if you want to be portable, stay with RunPython instead of RunSQL
3) delete the ManyToManyField
4) recreate the ManyToManyField with the through option
All this can (and I think, should) go into the same migration file. 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.
Best,
Gergely
On 23 Jul 2015 19:08, "Carsten Fuchs" <carsten.fuchs@cafu.de> wrote:
-- Hi Carl,
Am 23.07.2015 um 18:28 schrieb Carl Meyer:
Overall I think it might be simpler to go with your initial approach. I'd first rename
the old field to some other temporary name (you don't have to update any other code to
use this name, as you'll commit all of these migrations in one commit, so nothing but
the following data migration ever needs to know anything about this temporary name),
Thanks for clarifying the details regarding renaming! With this, this is the approach that I feel the most comfortable with and will try now.
Overall, many thanks for your thoughts and your detailed reply, it's very much appreciated and helps a lot!
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/55B11F7B.1010805%40cafu.de.
For more options, visit https://groups.google.com/d/optout.
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/CACczBU%2BYcmaxdqr7q-i%3DY1Xe3U%2BE0BqUF%2BqbBWFhthQoWFOg7w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment