On 8/22/05, Brant Harris <[EMAIL PROTECTED]> wrote:
> 
> > My question is.. if order matters, is there the possibility, expecially
> > in complex models, to reach a "deadlock" condition?
> >
> 
> I see where you are headed, though, and the answer is no, it can't
> ever happen.  You'll notice that when you try to reference an entity
> that hasn't been defined yet, the interpreter throws a NameError; this
> happens because the token-name you gave it, in your case 'Recipie',
> isn't defined anywhere yet.  So you can't even arrive at a sort of
> 'deadlock' situation.
> 

I think what Paolo was getting at is whether the modelling system can
handle a circular relationship - something as simple as 'each employee
works in a department; each department is managed by an employee'.

How would this model be implemented in Django? The API provides a
special case where a recursive relationship back to the current entity
is denoted by ForeignKey('self'), but for the more general case of a
circular relationship I can't see a way to avoid the NameError.

I know in SqlObject the class's name can be used instead of a
reference to the class, providing late binding to enable this kind of
model.

xtian

Reply via email to