--
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...@googlegroups.com.
To post to this group, send email to django...@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/d5d6fcf9-8b76-4448-81fb-e38765b66d03%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On 3 Nov 2015 06:07, "Mike Dewhirst" <mi...@dewhirst.com.au> wrote:
>
> On 3/11/2015 9:55 AM, Alex Heyden wrote:
>>
>> I tried putting the model back in its original module with some much smaller changes, but I'm getting the same error. The error is nonsense in the current context.
>>
>> Is there some intermediate state saved somewhere when you try to run makemigrations?
>
>
> Not as far as I can tell. I too have had difficulty moving models between apps. It is in my too-hard basket for the moment. However ...
>
> When I try again I'll create the model-to-be-moved in its new app and get that working properly. I would definitely do a makemigration but edit the migration file prior to migrating to use a forwards_func() method to get the data across and entrenched in its proper relations with other models on creation. Finally, when all is working I'd bravely drop the old model in a separate migration.
I totally agree with this approach. You copy the model from app A to app B, update all objects to use app B and copy all data from A to B with a RunPython function. This all should go in a migration file under app B. Then, from within a migration under app A, remove the model. If you are sure this app won't ever be used outside your project, you can make the migration in app A to depend on the migration in app B, either, so there will be no chance that your data gets copied before it is deleted.
Best,
Gergely
> To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
> To post to this group, send email to django...@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/563840E7.7060103%40dewhirst.com.au.