﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
21828	Can no longer use model meta methods in other methods after app loading changes	Tim Graham	nobody	"To reproduce, add the following as an attribute to the `Choice` model in the tutorial and try to `runserver`:

`foo = Poll._meta.get_all_field_names()`

{{{
Traceback (most recent call last):
  File ""manage.py"", line 10, in <module>
    execute_from_command_line(sys.argv)
  File ""/home/timgraham/code/tutorial/local/lib/python2.7/site-packages/django/core/management/__init__.py"", line 427, in execute_from_command_line
    utility.execute()
  File ""/home/timgraham/code/tutorial/local/lib/python2.7/site-packages/django/core/management/__init__.py"", line 391, in execute
    django.setup()
  File ""/home/timgraham/code/tutorial/local/lib/python2.7/site-packages/django/__init__.py"", line 21, in setup
    apps.populate(settings.INSTALLED_APPS)
  File ""/home/timgraham/code/tutorial/local/lib/python2.7/site-packages/django/apps/registry.py"", line 105, in populate
    app_config.import_models(all_models)
  File ""/home/timgraham/code/tutorial/local/lib/python2.7/site-packages/django/apps/base.py"", line 160, in import_models
    self.models_module = import_module(models_module_name)
  File ""/usr/lib/python2.7/importlib/__init__.py"", line 37, in import_module
    __import__(name)
  File ""/home/timgraham/code/mysite/polls/models.py"", line 21, in <module>
    class Choice(models.Model):
  File ""/home/timgraham/code/mysite/polls/models.py"", line 26, in Choice
    foo = Poll._meta.get_all_field_names()
  File ""/home/timgraham/code/tutorial/local/lib/python2.7/site-packages/django/db/models/options.py"", line 420, in get_all_field_names
    cache = self.init_name_map()
  File ""/home/timgraham/code/tutorial/local/lib/python2.7/site-packages/django/db/models/options.py"", line 433, in init_name_map
    for f, model in self.get_all_related_m2m_objects_with_model():
  File ""/home/timgraham/code/tutorial/local/lib/python2.7/site-packages/django/db/models/options.py"", line 550, in get_all_related_m2m_objects_with_model
    cache = self._fill_related_many_to_many_cache()
  File ""/home/timgraham/code/tutorial/local/lib/python2.7/site-packages/django/db/models/options.py"", line 564, in _fill_related_many_to_many_cache
    for klass in self.apps.get_models():
  File ""/home/timgraham/code/tutorial/local/lib/python2.7/site-packages/django/utils/lru_cache.py"", line 101, in wrapper
    result = user_function(*args, **kwds)
  File ""/home/timgraham/code/tutorial/local/lib/python2.7/site-packages/django/apps/registry.py"", line 155, in get_models
    self.check_ready()
  File ""/home/timgraham/code/tutorial/local/lib/python2.7/site-packages/django/apps/registry.py"", line 118, in check_ready
    raise RuntimeError(""App registry isn't ready yet."")
RuntimeError: App registry isn't ready yet.
}}}"	Bug	closed	Database layer (models, ORM)	dev	Normal	wontfix	app-loading		Unreviewed	0	0	0	0	0	0
