On Aug 24, 6:29 pm, Tom Evans <tevans...@googlemail.com> wrote:
> On Wed, Aug 24, 2011 at 2:12 PM, john <deont...@gmail.com> wrote:
> > i had three tables,
> > trademarks, publication, and entry
> > trademarks has a foreign key to publication, and publication has a
> > foreign key to entry, and entry has a field called published_date,
> > which i am intrested in..
> > how should i go about such using filters or similar..
> > when i am writing something like this...
> > tm_queryset =
> > Trademarks.objects.all().filter(created_by__id__exact=76).....
>
> > i have tried this.. but guess its too off the mark..
> > t   =
> > Trademark.objects.all().filter(created_by__id__exact=curr_id).select_related('pub_date','publication_id').filter(pub_date__range=(start_date,end_date),
> > status__exact=status_code, publication_id__exact=pubid)
>
> You need to explain more clearly what information you want to
> retrieve, what you have tried, what happened, why that isn't what you
> want.
>
> Cheers
>
> Tom

well..
trademark is a table which has a foreignkey (called publication) to
table publication.
entry is a table with foreignkey (called publication ) to table
publication.

now i want to retrieve all trademark objects which are published
between certain dates and created by some id say 76.. pub_date being a
publication table's field..
i write something like this..

** tobjs =
Trademark.objects.filter(created_by__id__exact=76).filter(publication__entry__pub_date__range=('start_date','end_date'))

start_date, end_date are defined previously elsewhere..
tobj.count() gives me 0 which should not be the case..
 (** i intend this to work as.. get me all trademark objects created
by id 76 and span the relationship across publication and entry to get
pub_date field which is entry's field and retrieve all published b/w
them )..



-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to