Hi all,

Would anyone be able to give some "best practice" information on how
to use django with multiple models files?  My current setup is (SVN
Django):

/myproject/
    app1/
        models/
              __init__.py - has all of the "from tag import Tag" lines
so syncdb works (when validation does)
              tag.py - has "class Tag(models.Model)..."
              ...

Ok, so far, so good.  But when I start trying to use foreign keys that
are many-to-manys (custom, not ManyToManyField because need attributes
on relation) between the same model and circular associations
(friendships) I start running into some problems.

1. It seems you cannot use field1 models.ForeignKey('Whatever'), the
quoted model name just fails validation with: AttributeError: 'str'
object has no attribute '_meta' (/django/db/models/options.py", line
~127, in get_all_related_objects)

2. ...which means I have to import, but:
import tag
...
   fields = models.ManyToManyField(tag.Tag)
...
Seems to not work either (or I'm crazy)

3. Doing any find of "from tag import Tag" works, but then circular
dependencies always start to appear.

Could anyone point the way for me?  I don't think my answer is "all
models in one file" since this is a very large site with 80+ models.

Many thanks,

jesse

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to