Hi guys,

I'm facing strange problems with dates in django. I have an object
list called from a view with the following code is

...
now = datetime.datetime.now()
period_limit = now - datetime.timedelta(days=30)
queryset = queryset.filter(
     item__pub_date__lte=now, # no future items
     item__pub_date__gte=period_limit, # no past items
     item__is_active=True, # only active items
     item__is_removed=False, # no removed items
).order_by('-classified__pub_date')
...

Sometimes the datetime.datetime.now() returns "X", sometimes it retusn
"X - 2 hours". I search google for similar problems without success.
The queryset seems to be ok, I checked with sql_queries template
variable. The problem is with python datetime.now() function.

I can't tell what triggers the problem. The site is running on a
server with 10 more little sites, this is the only one running on
django1.1, the other ones run on django1.0.2. It run on an ubuntu
hardy server with python2.5.2.

I don't know how fix this problem. Does anyone had the same problem?

I thinking in filter the queryset using database NOW() function, is
there a way to do this filter using queryset.filter interface?

Thanks in advance,
Best regards.
--~--~---------~--~----~------------~-------~--~----~
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