If my understanding is correct, when you use this method:

> choices = {
>     'queryset': Poll.objects.filter(opening_date__lte=datetime.now(),
> closing_date__gte=datetime.now())
> }

The value of datetime.now() is evaluated at compilation time when
apache/mod_python is started (or at least when the .pyc file is
created) and the date and time of compilation will be used as long as
apache keeps running. However, by doing:

> now = datetime.now()
>
> choices = {
>     'queryset': Poll.objects.filter(opening_date__lte=now,
> closing_date__gte=now)
> }
>

This will force the value of datetime.now to be evaluated only at run
time. In other words, the value will actually represent the current
time when the request is made.


-- 
----
Waylan Limberg
[EMAIL PROTECTED]

--~--~---------~--~----~------------~-------~--~----~
 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