django migration doesn't automatically recognize the added fields using add_to_class()

Viewed 137

I've created a subclass for reusable-package.models.Topic in my-project but the related models (those having a FK to Topic) are still referencing reusable-package.models.Topic. So as a solution for that is to subclass all models of reusable package (those having a FK to Topic) and make the explicit reference to the new model

tried to fix that using add_to_class to add field instead of using inheritance

the added code is the following:

Topic.add_to_class('color', models.CharField(max_length=7, null=True, blank=True, help_text=_('HEX Color code')))

but the automatic migration doesn't recognize the added fields so i should manually create the migrations ./manage.py makemigrations

regards,

0 Answers
Related