On Wed, 2006-10-11 at 09:52 +0100, Tom Smith wrote:
> It has a lot of stuff... but the core is simple enough, like this...
> 
> class Product(models.Model):
>       title =  models.CharField(maxlength=200, db_index=True)
>       url = models.URLField(maxlength=250, db_index=True, unique=True)
>                       
> 
> class Word(models.Model):
>       value =  models.CharField(maxlength=200, core=True, unique=True)
>       product_count =  models.IntegerField(default=0)
> 
> 
> class  ProductWord(models.Model):
>       fk_word = models.ForeignKey(Word, edit_inline=models.STACKED,  
> num_in_admin=3, core=True)
>       fk_product = models.ForeignKey(Product, edit_inline=models.STACKED,  
> num_in_admin=3)

Using those exact models and the query Rajesh posted (which looked right
to me, too), this works correctly. I don't see the error you reported. 

I suspect you typed in the original query incorrectly: in the section
that says "productword__fk_word__value__exact" there are two underscores
separating each of the words (except for "fk_word", of course). If you
only put in a single underscore, you get the error message you reported.

This query construction, which is querying a related model backwards and
then walking through another relation in the forwards direction, is
documented here:
http://www.djangoproject.com/documentation/db_api/#lookups-that-span-relationships
 (the backwards direction is the second example there).

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

Reply via email to