On 8/22/05, Brant Harris <[EMAIL PROTECTED]> wrote:
>
> I agree that it seems odd that Django would, in effect, force it's
> ways upon you. But Django has been developed under a philosophy of
> adding functionality only if there is a solid use-case for it. So if
> you can conjure up a model tha
Hrm, well that's sort of how you do it. Take a look at something I
have in a model that I am developing:
meta.ForeignKey(auth.User, rel_name="manager",
related_name="managing", null=True),
meta.ManyToManyField(auth.User, rel_name="supervisors",
On 8/22/05, Brant Harris <[EMAIL PROTECTED]> wrote:
>
> > 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
> 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 SqlOb
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
> My question is.. if order matters, is there the possibility, expecially
> in complex models, to reach a "deadlock" condition?
>
"Deadlock" really only occurs between processes or threads
(http://en.wikipedia.org/wiki/Deadlock). So that is impossible here
because your django model is being pro
Hi Brant, thanks for your comment. Effectively the model was wrong and
your fix has been very useful.
This is the working version:
from django.core import meta
class Ingredient(meta.Model):
fields = (
meta.CharField('name', 'Name', maxlength=128),
meta.TextField('description'
Well I'm not exactly sure what's causing your problem, I have a hunch
it has something to do with that to_field option. But regardless,
look at your model: Since your Recipie contains the ForeignKey to
Intermediary, each of your Recipies can only have one Intermediary,
and therefore one Ingredie
This is my solution to add to a recipe an arbitrary number of
ingredients, each of them with a quantity specified.
from django.core import meta
class Ingredient(meta.Model):
fields = (
meta.CharField('name', 'Name', maxlength=128),
meta.TextField('description', 'Description',
9 matches
Mail list logo