Tuesday, February 26, 2013

Re: A query question

yes for me but if you want see the query 
you try use django-debug-toolbar and you see how long it takes the query

Cheers


On Tue, Feb 26, 2013 at 11:59 AM, ozgur yilmaz <yelbuke@gmail.com> wrote:
Hi,

Actually my question is not about the date range. i'm planning to use
__lte and __gte filters. My problem is to solve the query (getting A
objects using B objects) inexpensively. Thanks anyway,

I used:

b_objects = B.objects.filter( activity_date__gte = specific_start_date
, activity_date__lte = specific_end_date )

a_objects = A.objects.exclude( kisi__in = b_objects )

Is it enough?

2013/2/26 carlos <crocha09.09@gmail.com>:
> Hi, maybe use DateField__range(date1,date2)
>
> Cheers
>
>
> On Tue, Feb 26, 2013 at 5:43 AM, ozgur yilmaz <yelbuke@gmail.com> wrote:
>>
>> Hi all,
>>
>> I have to build a query, if possible an inexpensive query:
>>
>> Model A:
>> ...
>> ...
>>
>> Model B:
>> ForeignKey( Model A )
>> Date
>> ...
>>
>> Model B is an activity with a date field. I want to find which Model A
>> objects didnt join an activity between specific dates.
>>
>> What are the appropriate ways to find this result? Any ideas?
>>
>> Thanks,
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscribe@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscribe@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.



--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment