﻿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
25686	"Database router without ""allow_migrate"" method raises exception"	Josep Cugat	nobody	"It seems Django 1.8.6 has introduced an error when using a database router that doesn't have a ""allow_migrate"" method. The router we are using is [https://github.com/jbalogh/django-multidb-router/blob/master/multidb/__init__.py#L83 PinningMasterSlaveRouter], which has a ""allow_syncdb"" method but no ""allow_migrate"". This was working with Django 1.8.5 (as seen in #24532), and it seems that the commit which introduced this is [https://github.com/django/django/commit/e2ea30c4403fca1b0a2032aae7a783f8705fc08b e2ea30c].

The traceback:

{{{
./manage.py migrate
Traceback (most recent call last):
  File ""./manage.py"", line 15, in <module>
    execute_from_command_line(sys.argv)
  File ""/opt/lib/python2.7/site-packages/django/core/management/__init__.py"", line 354, in execute_from_command_line
    utility.execute()
  File ""/opt/lib/python2.7/site-packages/django/core/management/__init__.py"", line 346, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File ""/opt/lib/python2.7/site-packages/django/core/management/base.py"", line 394, in run_from_argv
    self.execute(*args, **cmd_options)
  File ""/opt/lib/python2.7/site-packages/raven/contrib/django/management/__init__.py"", line 41, in new_execute
    return original_func(self, *args, **kwargs)
  File ""/opt/lib/python2.7/site-packages/django/core/management/base.py"", line 444, in execute
    self.check()
  File ""/opt/lib/python2.7/site-packages/django/core/management/base.py"", line 482, in check
    include_deployment_checks=include_deployment_checks,
  File ""/opt/lib/python2.7/site-packages/django/core/checks/registry.py"", line 72, in run_checks
    new_errors = check(app_configs=app_configs)
  File ""/opt/lib/python2.7/site-packages/django/core/checks/model_checks.py"", line 28, in check_all_models
    errors.extend(model.check(**kwargs))
  File ""/opt/lib/python2.7/site-packages/django/db/models/base.py"", line 1207, in check
    errors.extend(cls._check_long_column_names())
  File ""/opt/lib/python2.7/site-packages/django/db/models/base.py"", line 1610, in _check_long_column_names
    if not router.allow_migrate_model(db, cls):
  File ""/opt/lib/python2.7/site-packages/django/db/utils.py"", line 367, in allow_migrate_model
    model=model,
  File ""/opt/lib/python2.7/site-packages/django/db/utils.py"", line 343, in allow_migrate
    argspec = inspect.getargspec(router.allow_migrate)
AttributeError: 'PinningMasterSlaveRouter' object has no attribute 'allow_migrate'
}}}"	Bug	closed	Database layer (models, ORM)	1.8	Release blocker	fixed	allow_migrate		Ready for checkin	1	0	0	1	0	0
