bernardopires / django-tenant-schemas

Tenant support for Django using PostgreSQL schemas.
https://django-tenant-schemas.readthedocs.org/en/latest/
MIT License
1.46k stars 423 forks source link

"ValueError: Encountered duplicate field name: 'default'" on any manage.py command #472

Closed empiricalthought closed 7 years ago

empiricalthought commented 7 years ago

Hello,

When I add "tenant_schemas" to the INSTALLED_APPS setting in Django 1.11 and Python 3.5, and use any manage.py command, the following error occurs:

Traceback (most recent call last):
  File "/venvdir/lib/python3.5/site-packages/django/utils/autoreload.py", line 227, in wrapper
    fn(*args, **kwargs)
  File "/venvdir/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run
    autoreload.raise_last_exception()
  File "/venvdir/lib/python3.5/site-packages/django/utils/autoreload.py", line 250, in raise_last_exception
    six.reraise(*_exception)
  File "/venvdir/lib/python3.5/site-packages/django/utils/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/venvdir/lib/python3.5/site-packages/django/utils/autoreload.py", line 227, in wrapper
    fn(*args, **kwargs)
  File "/venvdir/lib/python3.5/site-packages/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/venvdir/lib/python3.5/site-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models()
  File "/venvdir/lib/python3.5/site-packages/django/apps/config.py", line 202, in import_models
    self.models_module = import_module(models_module_name)
  File "/venvdir/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 673, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/venvdir/lib/python3.5/site-packages/tenant_schemas/models.py", line 4, in <module>
    from tenant_schemas.postgresql_backend.base import _check_schema_name
  File "/venvdir/lib/python3.5/site-packages/tenant_schemas/postgresql_backend/base.py", line 12, in <module>
    from tenant_schemas.postgresql_backend.introspection import DatabaseSchemaIntrospection
  File "/venvdir/lib/python3.5/site-packages/tenant_schemas/postgresql_backend/introspection.py", line 10, in <module>
    FieldInfo = namedtuple('FieldInfo', FieldInfo._fields + ('default',))
  File "/venvdir/lib/python3.5/collections/__init__.py", line 413, in namedtuple
    raise ValueError('Encountered duplicate field name: %r' % name)
ValueError: Encountered duplicate field name: 'default'
empiricalthought commented 7 years ago

I see https://github.com/bernardopires/django-tenant-schemas/pull/463 is open and has fixes for this and another error I see with Django 1.11, so I will close this issue.