I've seen several references to this error:

    AttributeError: 'str' object has no attribute '_meta'

It seems this all has to do with forward model referencing of one kind
or another. In other words, you are referencing a model that
references another model to be named later (probably one that is
located in another model file). I just spent 2 days banging my head
against the wall trying to figure out how one standalone program threw
this error while other programs did not.

It turns out my program was using a model (table) that referenced
another model (table) in another file, but was never actually directly
using the other model. Trying to be efficient, I only imported the
model file I was using. After reading several postings, I decided I
needed to import both models. Still did not work. Finally, I noticed
the import order of the program that worked was opposite from the
program that didn't work. After reversing the import order, it all
worked just fine.

So, if you're getting the dreaded error with this import ordering:

import mysite.app2.models ## Containing the model(s) you're using directly
import mysite.app1.models ## Containing the forward referenced model

Try this:

import mysite.app1.models ## Containing the forward referenced model
import mysite.app2.models ## Containing the model(s) you're using directly

Whew!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to