On Dec 26, 2007 4:04 PM, Ryan K <ryankaskel gmail.com> wrote:
> def get_sp_from_date_range(start_date, end_date,
order=False):
> s_products =
ScheduledProduct.objects.filter(start__gt=start_date)
> s_products =
s_products.filter(finish__lt=end_date)
> if order:
> return s_products.order_by('finish')
> else:
> return s_products
>
> When order==True these are the results:
>
> ..
> 2007-12-25 00:00:00
> 2008-01-01 00:00:00
> 2007-12-25 01:27:11
> 2007-12-25 04:27:11
> 2007-12-25 08:27:11
> ...
>
> Is this the correct behavior?
It doesn't look like it.
with settings.DEBUG = True, you can inspect the SQL that's
being run this way:
>>> from django.db import connection
>>> print connection.queries
If the SQL being run includes the expected order by clause,
then it's
time to go to the DB to verify that it gives the expected
results.
Not that the SQL included in connection.queries is a bit
different
from what's actually run on your DB since quoting is handled
by the DB
driver, not Django, but it should get you in the right
ballpark.
--~--~---------~--~----~------------~-------~--~----~
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-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|