#23487: save() returns error "Models aren't loaded yet."
--------------------------------------+--------------------
Reporter: nmarler | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: 1.7
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+--------------------
https://docs.djangoproject.com/en/1.7/intro/tutorial01/
Section "Playing with the API"
Following along with the tutorial (using default SQLite db) calling save
returns the following error (but it appears that the call actually
worked?)
{{{
>>> q.question_text = "What's up?"
>>> q.save()
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\Python27\lib\site-packages\django\db\models\base.py", line 590,
in save
force_update=force_update, update_fields=update_fields)
File "C:\Python27\lib\site-packages\django\db\models\base.py", line 618,
in save_base
updated = self._save_table(raw, cls, force_insert, force_update,
using, update_fields)
File "C:\Python27\lib\site-packages\django\db\models\base.py", line 680,
in _save_table
forced_update)
File "C:\Python27\lib\site-packages\django\db\models\base.py", line 710,
in _do_update
filtered = base_qs.filter(pk=pk_val)
File "C:\Python27\lib\site-packages\django\db\models\query.py", line
691, in filter
return self._filter_or_exclude(False, *args, **kwargs)
File "C:\Python27\lib\site-packages\django\db\models\query.py", line
709, in _filter_or_exclude
clone.query.add_q(Q(*args, **kwargs))
File "C:\Python27\lib\site-packages\django\db\models\sql\query.py", line
1287, in add_q
clause, require_inner = self._add_q(where_part, self.used_aliases)
File "C:\Python27\lib\site-packages\django\db\models\sql\query.py", line
1314, in _add_q
current_negated=current_negated, connector=connector)
File "C:\Python27\lib\site-packages\django\db\models\sql\query.py", line
1138, in build_filter
lookups, parts, reffed_aggregate = self.solve_lookup_type(arg)
File "C:\Python27\lib\site-packages\django\db\models\sql\query.py", line
1076, in solve_lookup_type
_, field, _, lookup_parts = self.names_to_path(lookup_splitted,
self.get_meta())
File "C:\Python27\lib\site-packages\django\db\models\sql\query.py", line
1339, in names_to_path
field, model, direct, m2m = opts.get_field_by_name(name)
File "C:\Python27\lib\site-packages\django\db\models\options.py", line
416, in get_field_by_name
cache = self.init_name_map()
File "C:\Python27\lib\site-packages\django\db\models\options.py", line
445, in init_name_map
for f, model in self.get_all_related_m2m_objects_with_model():
File "C:\Python27\lib\site-packages\django\db\models\options.py", line
563, in get_all_related_m2m_objects_with_model
cache = self._fill_related_many_to_many_cache()
File "C:\Python27\lib\site-packages\django\db\models\options.py", line
577, in _fill_related_many_to_many_cache
for klass in self.apps.get_models():
File "C:\Python27\lib\site-packages\django\utils\lru_cache.py", line
101, in wrapper
result = user_function(*args, **kwds)
File "C:\Python27\lib\site-packages\django\apps\registry.py", line 168,
in get_models
self.check_models_ready()
File "C:\Python27\lib\site-packages\django\apps\registry.py", line 131,
in check_models_ready
raise AppRegistryNotReady("Models aren't loaded yet.")
AppRegistryNotReady: Models aren't loaded yet.
>>> q.question_text
"What's up?"
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23487>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" 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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/050.50d9d4356f4bf1c4e892f336dbc60fd3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.