Thanks Malcom, that was helpful.

Jacob

-----Original Message-----
From: django-users@googlegroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of Malcolm Tredinnick
Sent: Friday, October 10, 2008 8:41 PM
To: django-users@googlegroups.com
Subject: Re: model definition must come before reference in
models.ForeignKey?



On Fri, 2008-10-10 at 19:39 -0400, Fenwick, Jacob L. wrote:
> If I have a model that has a models.ForeignKey field, does the model
> it depends on have to be defined before the model that contains the
> field?
> 
>  
> 
> I suppose this makes sense, but what if I have a very complicated
> hierarchy? Such as if I have three tables, and their foreign keys
> relationships form a triangle?

This is documented as almost the first thing in the documentation for
ForeignKey.

 http://docs.djangoproject.com/en/dev/ref/models/fields/#foreignkey

        "If you need to create a relationship on a model that has not
        yet been defined, you can use the name of the model, rather
than
        the model object itself."
        
The documentation really is your friend when learning Django (and
afterwards).
        
Regards,
Malcolm

> 




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