Skip to content

get_application_model incompatible with Django 1.7 #151

@ghost

Description

get_application_model works fine with Django 1.6.5, but fails with 1.7.
Application = get_application_model() is executed at the top level of the application's model.py

Traceback (most recent call last):
  File "manage.py", line 12, in <module>
    execute_from_command_line(sys.argv)
  File "<pythonpath>/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "<pythonpath>/site-packages/django/core/management/__init__.py", line 354, in execute
    django.setup()
  File "<pythonpath>/site-packages/django/__init__.py", line 21, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "<pythonpath>/site-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models(all_models)
  File "<pythonpath>/site-packages/django/apps/config.py", line 197, in import_models
    self.models_module = import_module(models_module_name)
  File "<pythonpath>/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "<projpath>/myapp/models.py", line 35, in <module>
    Application = get_application_model()
  File "<pythonpath>/site-packages/oauth2_provider/models.py", line 241, in get_application_model
    app_model = get_model(app_label, model_name)
  File "<pythonpath>/site-packages/django/apps/registry.py", line 199, in get_model
    self.check_models_ready()
  File "<pythonpath>/site-packages/django/apps/registry.py", line 131, in check_models_ready
    raise AppRegistryNotReady("Models aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions