Hello,
does anybody knows, how to implement cross-refering models across files?

Simple example:
file 'models/a.py'
class A(models.Model):
     ref_to_b = models.ForeignKey('B')
     ...
     class Meta:
         app_label = 'example_app'

file 'models.b.py;
class B(models.Model):
     ref_to_a = models.ForeignKey('A')
     ...
     class Meta:
         app_label = 'example_app'

REason for doing this is that models.py is becoming a _huge_ one. But 
when i put these two files in models directory (with appropriate 
__init__.py) I get (logical) error from get_all_related_objects from 
djago.db.core.options which coredumps in point where it wants to load 
some data from (not yet defined) class B. Is there any general technique 
to workaround this behaviour, or it is completely problem of model design?

Thanks for some future response.

-- 

                        Tomas Kopecek
                        e-mail: permonik at mesias.brnonet.cz
                         ICQ: 114483784

--~--~---------~--~----~------------~-------~--~----~
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