On 1/11/07, Waylan Limberg <[EMAIL PROTECTED]> wrote:
>
> 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.
>

Thanks for your reply!

Unfortunately, this doesn't seem to help. If I use the latter method,
I get better results. However, after the poll closed, the poll was
still visible on the page the queryset was sent to. Restarting apache
solved the problem. This doesn't persist on the development server

So, if anyone has any ideas on this problem, please let me know.

I tried the date based generic view and it sort of worked (at least,
better than this one), but the main problem is the mandatory use of
date in url, which seems sort of overkill when having a randomly
updating voting application

-- 
Jyrki // [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