#10466: functions as QuerySets' parameters are not lazy
------------------------------------------+---------------------------------
 Reporter:  liangent                      |       Owner:  nobody    
   Status:  new                           |   Milestone:            
Component:  Database layer (models, ORM)  |     Version:  SVN       
 Keywords:                                |       Stage:  Unreviewed
Has_patch:  0                             |  
------------------------------------------+---------------------------------
 if i write code like this:
 {{{
 qs = MyModel.objects.filter(dt__lte=datetime.datetime.now)
 }}}
 and execute it at time A, then save {{{ qs }}} somewhere.

 later, at time B, i call {{{ for obj in qs }}} to get the object list. as
 the documentation says, database query is executed at time B. however, it
 seems that the value of {{{ dt__lte }}} was fetched at time A (ie. {{{
 datetime.datetime.now }}} was evaluated at time A), and i think {{{
 datetime.datetime.now }}} should be evaluated at time B (if i wrote
 {{{
 qs = MyModel.objects.filter(dt__lte=datetime.datetime.now())
 }}}
 , it should be evaluated at time A). it seems to go against "QuerySets are
 lazy", doesn't it?

-- 
Ticket URL: <http://code.djangoproject.com/ticket/10466>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to