#3501: sqlite selection on datetime members fail when datefield is null
-----------------------+----------------------------------------------------
Reporter:  anonymous   |       Owner:  adrian          
  Status:  new         |   Component:  Database wrapper
 Version:  SVN         |    Keywords:  sqlite          
   Stage:  Unreviewed  |   Has_patch:  1               
-----------------------+----------------------------------------------------
 Doing selects like {{{model.objects.filter(datefield__year=2007)}}} fail
 when a datefield contains a NULL value.
 Patch follows as a code block:
 
 {{{
 
 Index: django/db/backends/sqlite3/base.py
 ===================================================================
 --- django/db/backends/sqlite3/base.py  (revision 4501)
 +++ django/db/backends/sqlite3/base.py  (working copy)
 @@ -119,6 +119,7 @@
      return 'django_extract("%s", %s)' % (lookup_type.lower(), table_name)
 
  def _sqlite_extract(lookup_type, dt):
 +    if not dt: return None
      try:
          dt = util.typecast_timestamp(dt)
      except (ValueError, TypeError):
 
 }}}
 
 Thanks for all the good work!
 
 Niels Poppe

-- 
Ticket URL: <http://code.djangoproject.com/ticket/3501>
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