#7672: Add filter for 'Day of week' on Date / DateTime fields
---------------------------------------------+------------------------------
          Reporter:  rossp                   |         Owner:  nobody  
            Status:  new                     |     Milestone:  post-1.0
         Component:  Database wrapper        |       Version:  SVN     
        Resolution:                          |      Keywords:          
             Stage:  Design decision needed  |     Has_patch:  1       
        Needs_docs:  0                       |   Needs_tests:  0       
Needs_better_patch:  1                       |  
---------------------------------------------+------------------------------
Comment (by rossp):

 Attached another file, this one forces Oracle to use the American
 territory information, including Sunday=1.

 I'm not sure that this is the best way to do it, but it avoids doing
 another query at runtime. Another option, suggested by Ian Kelly, is to do
 a query at connection time and cache the resulting offset. This removes
 reliance on knowledge of Oracle's territories:

 {{{
 select to_char(to_date('06-JUL-2008', 'DD-MON-YYYY'), 'D') as 'testday'
 from dual;
 }}}

 If the resulting 'testday' field is 1, do nothing. If it's 7, treat dates
 like Python dates (eg "{{{ Monday-base-date % 7 + 1 = sunday-base-date
 }}}").

 For now I'm going to leave this one as-is until someone can confirm it
 works with Oracle, unless the devs believe we should test this offset. It
 will result in an extra query for each connection, I'm not sure if that's
 a problem or not.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/7672#comment:7>
Django Code <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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to