On Wed, 2007-04-18 at 23:28 +0100, Merric Mercer wrote:
> I'm have the following three Models.
> 
> 1.Category Model
> 
> 2. Promotion Model
>     - Has a many to many relationship with Category.
>     -  Is the Parent of the Cash Model.
> 
> 3.Cash Model
>   - Has one to one relationship with Promotion.
> 
> 
> I want to create a query set of  Cash Objects, filtered by a specific 
> Category.id
> 
> I'm sure that there must be simple solution - but having looked through 
> the forums I just can't figure how to do it.
> 
> Can anybody please advise.

Wtihout seeing your models (what you called the fields, etc) it's hard
to be precise, but the following should do what you want:

        Cash.objects.filter(promotion__category=6)

I'm assuming the one-to-one field in Cash is called "parent" and the
Category field in Promotion is called "category".

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