id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 22518 Migrations broken with custom user model Stephen Burrows nobody "This is *not* the same bug as #22325, though it may be related. Also related to #22397 (in that the fix there caused this bug to appear). I only know this is related to custom user models because migrations work fine if I remove the setting (and convert the custom user model to a normal model) and *then* generate and run them. To reproduce: 1. Make an app with a custom user model and a few migrations 2. Remove all references to `migrations.swappable_dependency(settings.AUTH_USER_MODEL)` as a workaround for #22325 3. Migrations fail. If that doesn't work, or if you'd like to skip that step, you can just use https://github.com/littleweaver/django-brambling@e6f9b24f69d56c1a33a3c737596690b685c3a68a The migrations fail like this: {{{ $ ./manage.py migrate Operations to perform: Synchronize unmigrated apps: floppyforms, sessions, admin, auth, zenaida, contenttypes Apply all migrations: brambling, auth Synchronizing apps without migrations: Creating tables... Creating table django_admin_log Creating table auth_permission Creating table auth_group_permissions Creating table auth_group Creating table django_content_type Creating table django_session Installing custom SQL... Installing indexes... Running migrations: Applying brambling.0001_initial... OK Applying brambling.0002_eventhousing_eventperson_home_housingslot_itemoption_payment_person_persondiscount...Traceback (most recent call last): File ""./manage.py"", line 10, in execute_from_command_line(sys.argv) File "".../django/django/core/management/__init__.py"", line 427, in execute_from_command_line utility.execute() File "".../django/django/core/management/__init__.py"", line 419, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "".../django/django/core/management/base.py"", line 288, in run_from_argv self.execute(*args, **options.__dict__) File "".../django/django/core/management/base.py"", line 337, in execute output = self.handle(*args, **options) File "".../django/django/core/management/commands/migrate.py"", line 145, in handle executor.migrate(targets, plan, fake=options.get(""fake"", False)) File "".../django/django/db/migrations/executor.py"", line 60, in migrate self.apply_migration(migration, fake=fake) File "".../django/django/db/migrations/executor.py"", line 88, in apply_migration if self.detect_soft_applied(migration): File "".../django/django/db/migrations/executor.py"", line 132, in detect_soft_applied apps = project_state.render() File "".../django/django/db/migrations/state.py"", line 63, in render model=dangling_lookup[0])) ValueError: Lookup failed for model referenced by field auth.Permission.content_type: contenttypes.ContentType }}} This bug exists in stable/1.7.x and master. I've already tried re-generating the migrations." Bug closed Migrations 1.7-beta-2 Normal duplicate Unreviewed 0 0 0 0 0 0