> class Product(models.Model):
> snip...
>
> class Word(models.Model):
> value = models.CharField(maxlength=200, core=True, unique=True)
>
> class ProductWord(models.Model):
> fk_word = models.ForeignKey(Word, core=True)
> fk_product = models.ForeignKey(Product)
>
Hang on...
I realise I should have a ManyToMany thing going on... apologies
--~--~-~--~~~---~--~~
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
I am really struggling with this...
class Product(models.Model):
snip...
class Word(models.Model):
value = models.CharField(maxlength=200, core=True, unique=True)
class ProductWord(models.Model):
fk_word = models.ForeignKey(Word, core=True)
fk_product = models.
On 3/19/06, Adrian Holovaty <[EMAIL PROTECTED]> wrote:
> Here's how I'd solve this particular problem:
>
> [c.get_poll() for c in choices.get_list(choice__exact='foo')]
>
> If you need to remove duplicates:
>
> dict([(c.get_poll(), 1) for c in
> choices.get_list(choice__exact='foo')]).keys
On 3/18/06, Ned Batchelder <[EMAIL PROTECTED]> wrote:
> I want to select objects based on their relationships with related
> objects, but I don't seem to be able to do it, because I'm trying to use
> a foreign key in the "wrong" direction. For example, in the Polls and
> Choices model, I can do t
On 3/18/06, Ned Batchelder <[EMAIL PROTECTED]> wrote:
>
> Or something like that, I'm backtranslating from my real app. Is there
> a cleaner way?
I think you can do this... Not very clean, but I just had lunch and
I am feeling sleepy.
poll_list = []
choice_list = choices.get_list(choice__exac
Don, thank, but the relationship here is one-to-many. Are you
suggesting artificially making it many-to-many to get the methods I
need?
--Ned.
Don Arbow wrote:
Check out the docs about many-to-many relationships. The link below
talks exactly about what you are asking.
http://www.django
Check out the docs about many-to-many relationships. The link below
talks exactly about what you are asking.
http://www.djangoproject.com/documentation/db_api/#many-to-many-
relations
On Mar 18, 2006, at 8:05 AM, Ned Batchelder wrote:
>
> I want to select objects based on their relationships
Ned Batchelder wrote:
> polls.get_list(choice__choice__exact="overeasy") # Doesn't work.
>
>Am I wrong? Please tell me there is a way to accomplish what I want.
>This is all in .91.
>
AFAIK this is one of the thing that magic-removal is solving. There you
would have Poll.choice_set which
I want to select objects based on their relationships with related
objects, but I don't seem to be able to do it, because I'm trying to use
a foreign key in the "wrong" direction. For example, in the Polls and
Choices model, I can do this (from the docs):
choices.get_list(poll__slug__exact
10 matches
Mail list logo