I extend the Django user model like this:
#core.models class Institute(models.Model): phone_regex = RegexValidator(regex=r'^\+?1?\d{9,15}$', message=institute_phone_help_text) name = models.CharField(_('name'), max_length=255) description = models.TextField(_('description'), blank=True) abbreviation = models.CharField(_('abbreviation'), blank=True, max_length=100) address = models.TextField(_('address'), blank=True) phone = models.CharField(validators=[phone_regex], max_length=17, blank=True) # validators should be a list websites = ArrayField(models.URLField(max_length=255), verbose_name=_('websites'), blank=True, null=True) class Meta: verbose_name = _('institute') verbose_name_plural = _('institutes') def __str__(self): return '{0} ({1})'.format(self.name, self.abbreviation) class User(AbstractUser): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) institute = models.ForeignKey(Institute, on_delete=models.CASCADE) params = JSONField(_('params'), null=True, blank=True,) about_me = models.TextField(_('about me'), blank=True,) With an empty DB each time that I launch ./manage.py makemigrations core it creates always a new migration file
import django.contrib.auth.models from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('core', '0002_auto_20190430_1655'), ] operations = [ migrations.AlterModelManagers( name='user', managers=[ ('objects', django.contrib.auth.models.UserManager()), ], ), ] I tried different combinations:
./manage.py makemigrations core ./manage.py migrate core ./manage.py migrate ./manage.py makemigrations core ./manage.py makemigrations core ./manage.py makemigrations ./manage.py migrate It always creates the migration file.
Thanks.
D
No changes detected