Re: How to remove a model definition completely in Django when it previously had foreign keys

2019-03-08 Thread James Bennett
When you need to remove any piece of code that's been referenced in migrations, generally there's a multi-step process. For sake of a simple example, let's assume you have Model A in App A, and Model B in App B. And at some point you added a foreign key from Model A to Model B, but now you want to

Re: How to remove a model definition completely in Django when it previously had foreign keys

2019-03-08 Thread Henrik Ossipoff Hansen
Yes, when running tests (which happen on a clean database), the migration history is run all from the initial migrations (by Django itself). At this point, app b's initial migration (which have a reference to a.A) will fail because it cannot find such model: ValueError: Related model 'a.A' cann

Re: How to remove a model definition completely in Django when it previously had foreign keys

2019-03-08 Thread Clara Daia
Are you getting an error? I think migration dependencies should solve that by themselves, running "step 2" before "step 3". Doesn't Django complain if you try to migrate "step 3" before "step 2"? Em sex, 8 de mar de 2019 às 11:07, Henrik Ossipoff Hansen < henrik.ossip...@gmail.com> escreveu: > We

How to remove a model definition completely in Django when it previously had foreign keys

2019-03-08 Thread Henrik Ossipoff Hansen
We're trying to remove a model completely from one of our apps - an operation I think we've done many times without issues, but this time it's causing us some headache. Consider we have two apps: An app called a with a model A An app called b with a model B, and this model B has a foreign key to