{"action":"created","issue":{"url":"https://api.github.com/repos/arteria/django-background-tasks/issues/18","labels_url":"https://api.github.com/repos/arteria/django-background-tasks/issues/18/labels{/name}","comments_url":"https://api.github.com/repos/arteria/django-background-tasks/issues/18/comments","events_url":"https://api.github.com/repos/arteria/django-background-tasks/issues/18/events","html_url":"https://github.com/arteria/django-background-tasks/issues/18","id":83192946,"number":18,"title":"Unable to import models_completed ","user":{"login":"aschuster3","id":2366147,"avatar_url":"https://avatars.githubusercontent.com/u/2366147?v=3","gravatar_id":"","url":"https://api.github.com/users/aschuster3","html_url":"https://github.com/aschuster3","followers_url":"https://api.github.com/users/aschuster3/followers","following_url":"https://api.github.com/users/aschuster3/following{/other_user}","gists_url":"https://api.github.com/users/aschuster3/gists{/gist_id}","starred_url":"https://api.github.com/users/aschuster3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aschuster3/subscriptions","organizations_url":"https://api.github.com/users/aschuster3/orgs","repos_url":"https://api.github.com/users/aschuster3/repos","events_url":"https://api.github.com/users/aschuster3/events{/privacy}","received_events_url":"https://api.github.com/users/aschuster3/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-31T21:27:02Z","updated_at":"2015-05-31T22:50:19Z","closed_at":null,"body":"When making migrations, I ran into an issue where it wouldn't properly generate due to an issue with importing models_completed in your admins.py \r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"manage.py\", line 10, in <module>\r\n    execute_from_command_line(sys.argv)\r\n  File \"C:\\Program Files (x86)\\Python\\lib\\site-packages\\django\\core\\management\\_\r\n_init__.py\", line 338, in execute_from_command_line\r\n    utility.execute()\r\n  File \"C:\\Program Files (x86)\\Python\\lib\\site-packages\\django\\core\\management\\_\r\n_init__.py\", line 312, in execute\r\n    django.setup()\r\n  File \"C:\\Program Files (x86)\\Python\\lib\\site-packages\\django\\__init__.py\", lin\r\ne 18, in setup\r\n    apps.populate(settings.INSTALLED_APPS)\r\n  File \"C:\\Program Files (x86)\\Python\\lib\\site-packages\\django\\apps\\registry.py\"\r\n, line 115, in populate\r\n    app_config.ready()\r\n  File \"C:\\Program Files (x86)\\Python\\lib\\site-packages\\django\\contrib\\admin\\app\r\ns.py\", line 22, in ready\r\n    self.module.autodiscover()\r\n  File \"C:\\Program Files (x86)\\Python\\lib\\site-packages\\django\\contrib\\admin\\__i\r\nnit__.py\", line 24, in autodiscover\r\n    autodiscover_modules('admin', register_to=site)\r\n  File \"C:\\Program Files (x86)\\Python\\lib\\site-packages\\django\\utils\\module_load\r\ning.py\", line 74, in autodiscover_modules\r\n    import_module('%s.%s' % (app_config.name, module_to_search))\r\n  File \"C:\\Program Files (x86)\\Python\\lib\\importlib\\__init__.py\", line 109, in i\r\nmport_module\r\n    return _bootstrap._gcd_import(name[level:], package, level)\r\n  File \"<frozen importlib._bootstrap>\", line 2254, in _gcd_import\r\n  File \"<frozen importlib._bootstrap>\", line 2237, in _find_and_load\r\n  File \"<frozen importlib._bootstrap>\", line 2226, in _find_and_load_unlocked\r\n  File \"<frozen importlib._bootstrap>\", line 1200, in _load_unlocked\r\n  File \"<frozen importlib._bootstrap>\", line 1129, in _exec\r\n  File \"<frozen importlib._bootstrap>\", line 1471, in exec_module\r\n  File \"<frozen importlib._bootstrap>\", line 321, in _call_with_frames_removed\r\n  File \"C:\\Program Files (x86)\\Python\\lib\\site-packages\\background_task\\admin.py\r\n\", line 2, in <module>\r\n    from models_completed import CompletedTask\r\nImportError: No module named 'models_completed'\r\n```\r\n\r\nI checked through and the module is definitely there, but it just wasn't getting read.  I fiddled around a bit, and found that the following change in admins.py fixed the issue and let migrations run:\r\n\r\n```\r\nfrom django.contrib import admin\r\n# from models_completed import CompletedTask  << Old\r\nfrom .models_completed import CompletedTask\r\n\r\nfrom .models import Task\r\n\r\n\r\nclass TaskAdmin(admin.ModelAdmin):\r\n    display_filter = ['task_name']\r\n    list_display = ['task_name', 'task_params', 'run_at', 'priority', 'attempts']\r\n\r\n\r\nadmin.site.register(Task, TaskAdmin)\r\nadmin.site.register(CompletedTask)\r\n```\r\n\r\nI'd make a pull request, but I honestly don't know if this is just a me-problem.  I'm running Win7 x64 using Django 1.8.2"},"comment":{"url":"https://api.github.com/repos/arteria/django-background-tasks/issues/comments/107254872","html_url":"https://github.com/arteria/django-background-tasks/issues/18#issuecomment-107254872","issue_url":"https://api.github.com/repos/arteria/django-background-tasks/issues/18","id":107254872,"user":{"login":"philippeowagner","id":113043,"avatar_url":"https://avatars.githubusercontent.com/u/113043?v=3","gravatar_id":"","url":"https://api.github.com/users/philippeowagner","html_url":"https://github.com/philippeowagner","followers_url":"https://api.github.com/users/philippeowagner/followers","following_url":"https://api.github.com/users/philippeowagner/following{/other_user}","gists_url":"https://api.github.com/users/philippeowagner/gists{/gist_id}","starred_url":"https://api.github.com/users/philippeowagner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philippeowagner/subscriptions","organizations_url":"https://api.github.com/users/philippeowagner/orgs","repos_url":"https://api.github.com/users/philippeowagner/repos","events_url":"https://api.github.com/users/philippeowagner/events{/privacy}","received_events_url":"https://api.github.com/users/philippeowagner/received_events","type":"User","site_admin":false},"created_at":"2015-05-31T22:50:19Z","updated_at":"2015-05-31T22:50:19Z","body":"Hi @aschuster3 \r\nThanks for reporting this! The best would be to refactor the complete module to [absolute imports](https://github.com/arteria/style-guide#absolute-and-relative-imports). It's not done yet consequently because we adopted this thing. Would be great, in case you intend to send a PR, to follow the guide mentioned above. "}}