Search code examples
djangomodelmigrationdjango-south

Django makemigrations make change for 'auth.user' every time


I upgrade my system's django version from 1.6.10 to 1.8.16 for test. On before version, i use South for migration. So, I followed 'https://docs.djangoproject.com/en/1.7/topics/migrations/#upgrading-from-south' this documentation.

My problem is every makemigrations are check same field, then make migration file. That field is 'auth.User' foreign key field. like user = models.ForeignKey('auth.User').

here are my screenshot for that problem.

enter image description here

enter image description here

This is Sample code for that foreign key field.

cancelled_by = models.ForeignKey(
    'auth.User',
    verbose_name=_("Cancelled by"),
    related_name='project_cancel',
    blank=True,
    null=True
)

How can i fix it?

edited: This is my migration file created by makemigrations after all migration.

class Migration(migrations.Migration):

dependencies = [
    ('meeting', '0003_meeting_proposal'),
]

operations = [
    migrations.AlterField(
        model_name='meeting',
        name='manager',
        field=models.ForeignKey(verbose_name='Manager', blank=True, to=settings.AUTH_USER_MODEL, null=True),
    ),
]

Solution

  • I would first delete the recently made migration files and try makemigration again.

    deleting migration files is a common solution since Django is smart enough to recreate them easily regardless of what has been changed in your folder.

    you can fake these migrations too, but i prefer to keep my migration folder clean and tidy.