{"action":"created","issue":{"url":"https://api.github.com/repos/tomturner/django-tenants/issues/34","labels_url":"https://api.github.com/repos/tomturner/django-tenants/issues/34/labels{/name}","comments_url":"https://api.github.com/repos/tomturner/django-tenants/issues/34/comments","events_url":"https://api.github.com/repos/tomturner/django-tenants/issues/34/events","html_url":"https://github.com/tomturner/django-tenants/issues/34","id":104312426,"number":34,"title":"Order of SHARED_APPS + TENANT_APPS causes import errors","user":{"login":"ivome","id":6703744,"avatar_url":"https://avatars.githubusercontent.com/u/6703744?v=3","gravatar_id":"","url":"https://api.github.com/users/ivome","html_url":"https://github.com/ivome","followers_url":"https://api.github.com/users/ivome/followers","following_url":"https://api.github.com/users/ivome/following{/other_user}","gists_url":"https://api.github.com/users/ivome/gists{/gist_id}","starred_url":"https://api.github.com/users/ivome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ivome/subscriptions","organizations_url":"https://api.github.com/users/ivome/orgs","repos_url":"https://api.github.com/users/ivome/repos","events_url":"https://api.github.com/users/ivome/events{/privacy}","received_events_url":"https://api.github.com/users/ivome/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-01T17:04:36Z","updated_at":"2015-09-01T17:22:17Z","closed_at":null,"body":"In the documentation we have the following line in the installation guide. \r\n\r\n```\r\n# settings.py\r\nINSTALLED_APPS = list(set(SHARED_APPS + TENANT_APPS))\r\n```\r\n\r\nThe problem with this is that it changes the order of the apps. I ran into import errors because some models were imported before the app was loaded:\r\n\r\nmodel doesn't declare an explicit app_label and either isn't in an application in INSTALLED_APPS or else was imported before its application was loaded. This will no longer be supported in Django 1.9.\r\n\r\nTo fix that I change it to the following: \r\n\r\n```\r\n# Add shared apps to installed apps\r\nINSTALLED_APPS = list(SHARED_APPS)\r\nfor app in TENANT_APPS:\r\n    if app not in INSTALLED_APPS:\r\n        INSTALLED_APPS.append(app)\r\n```\r\n\r\nThat works for me, but maybe other's need the TENANT_APPS first... Opinions? "},"comment":{"url":"https://api.github.com/repos/tomturner/django-tenants/issues/comments/136802153","html_url":"https://github.com/tomturner/django-tenants/issues/34#issuecomment-136802153","issue_url":"https://api.github.com/repos/tomturner/django-tenants/issues/34","id":136802153,"user":{"login":"kosz85","id":2547425,"avatar_url":"https://avatars.githubusercontent.com/u/2547425?v=3","gravatar_id":"","url":"https://api.github.com/users/kosz85","html_url":"https://github.com/kosz85","followers_url":"https://api.github.com/users/kosz85/followers","following_url":"https://api.github.com/users/kosz85/following{/other_user}","gists_url":"https://api.github.com/users/kosz85/gists{/gist_id}","starred_url":"https://api.github.com/users/kosz85/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kosz85/subscriptions","organizations_url":"https://api.github.com/users/kosz85/orgs","repos_url":"https://api.github.com/users/kosz85/repos","events_url":"https://api.github.com/users/kosz85/events{/privacy}","received_events_url":"https://api.github.com/users/kosz85/received_events","type":"User","site_admin":false},"created_at":"2015-09-01T17:22:17Z","updated_at":"2015-09-01T17:22:17Z","body":"Maybe better would be:\r\n```\r\nINSTALLED_APPS = list(SHARED_APPS) + [app for app in TENANT_APPS if app not in SHARED_APPS]\r\n```\r\n\r\nIn my project I don't have duplicates and I have just: `INSTALLED_APPS = SHARED_APPS + TENANT_APPS` and it works :)"}}