class PartVersionTree(models.Model):
fk_partversion = models.ForeignKey(PartVersion, null=True, blank=True,db_column='FK_PARTVERSION')
fk_associatedpartversion = models.ForeignKey(PartVersion, null=True, blank=True,db_column='FK_ASSOCIATEDPARTVERSION')
Changed in Django 1.10:
class PartVersionTree(models.Model):
fk_partversion = models.ForeignKey(PartVersion, null=True, blank=True,db_column='FK_PARTVERSION', related_name = '%(class)s_fk_partversion')fk_associatedpartversion = models.ForeignKey(PartVersion, null=True, blank=True,db_column='FK_ASSOCIATEDPARTVERSION', related_name = '%(class)s_fk_associatedpartversion')
Router definition:
def allow_migrate(self, db, app_label, model_name=None, **hints):
return False
just run >>> python manage.py migrations this will help
On Tuesday 06 June 2017 05:45:32 devansh dixit wrote:
> > just run >>> python manage.py migrations this will help
>
> you
No, it won't.
First it's `makemigrations`, second, he doesn't want to migrate the model, just the code.
It's an unmanaged model, so the correct fix, as Daniel pointed out is to declare the model as such.
And to clarify, why returning false in the router doesn't help:
The router check is one of 3 checks done. If any of the checks return True, it will attempt to make a migration.
--
Melvyn Sopacua
On Tuesday 06 June 2017 22:43:46 Priyanka Thakur wrote:
> Nothing helps till now !!
I'm going to guess, that marking a managed model as unmanaged, is a migration that needs to be done to keep a consistent migration history.
So first, make only that change and make the migration for it. Then change the related name and it should no longer make a migration.
--
Melvyn Sopacua