#10405: quoted class names in foreign key definition causes 'str' object has no
attribute '_default_manager'
---------------------------------------------------+------------------------
Reporter: danbrwn | Owner: mitsuhiko
Status: new | Milestone: 1.2
Component: Database layer (models, ORM) | Version:
1.0-alpha-2
Resolution: | Keywords:
foreign,key,quoted
Stage: Accepted | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------------+------------------------
Comment (by mkibbel):
I've been having a similar problem recently with one of my projects. The
AttributeError gets raised inside the call to admin.autodiscover() in my
urls.py, similar to bugs described in #8569. Due to model
interdependencies, I have to to use lazy model referencing with quoted
strings for some of the FK and M2M relationships in my project.
I never ran into this AttributeError until I turned DEBUG off. After
reading through these tickets and pouring through some of the Django
source code, I came up with a simple workaround for my particular problem.
Just add this to urls.py before calling admin.autodiscover():
{{{
from django.db.models.loading import cache as model_cache
if not model_cache.loaded:
model_cache.get_models()
}}}
My reasoning for this is explained briefly in the next comment.
--
Ticket URL: <http://code.djangoproject.com/ticket/10405#comment:11>
Django <http://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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---