On 11:39 Sun 26 Jan , Marcin Szamotulski wrote:
> Hello,
>
> I ask the question here since it is about the developed Django-1.7
> version but if you think that I should ask it at django-users then
> please excuse me.
>
> When I use get_user_model in a top level of another app models I got an
> error :
>
> >>> django.setup()
> File "<stdin>", line 1, in <module>
> File "/home/coot/webapps/social_feel/venv/src/django/django/__init__.py",
> line 21, in setup
> apps.populate(settings.INSTALLED_APPS)
> File
> "/home/coot/webapps/social_feel/venv/src/django/django/apps/registry.py",
> line 105, in populate
> app_config.import_models(all_models)
> File
> "/home/coot/webapps/social_feel/venv/src/django/django/apps/base.py", line
> 180, in import_models
> self.models_module = import_module(models_module_name)
> File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in
> import_module
> __import__(name)
> File
> "/home/coot/webapps/social_feel/venv/src/django-registration/registration/models.py",
> line 15, in <module>
> User = get_user_model()
> File
> "/home/coot/webapps/social_feel/venv/src/django/django/contrib/auth/__init__.py",
> line 133, in get_user_model
> user_model = apps.get_model(app_label, model_name)
> File
> "/home/coot/webapps/social_feel/venv/src/django/django/apps/registry.py",
> line 182, in get_model
> self.check_ready()
> File
> "/home/coot/webapps/social_feel/venv/src/django/django/apps/registry.py",
> line 118, in check_ready
> raise RuntimeError("App registry isn't ready yet.")
>
>
> This because in Django 1.7 get_user_model is using apps.get_model which
> checks if registry is ready, while the registry isn't, because it is
> being built. So the question is how, in a reusable app get the
> configured user model when the registry is not yet ready?
>
> Cheers,
> Marcin
I found the answer in a very recent ticket:
https://code.djangoproject.com/ticket/21875
Cheers,
Marcin Szamotulski
--
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/20140126114424.GB2749%40flying-circus.
For more options, visit https://groups.google.com/groups/opt_out.