#2443: Add IntervalField to database models
-------------------------------------------------------------+--------------
   Reporter:  [EMAIL PROTECTED]                           |                
Owner:  Gulopine              
     Status:  new                                            |            
Component:  Database wrapper      
    Version:  SVN                                            |           
Resolution:                        
   Keywords:  IntervalField interval duration DurationField  |                
Stage:  Design decision needed
  Has_patch:  1                                              |           
Needs_docs:  0                     
Needs_tests:  1                                              |   
Needs_better_patch:  1                     
-------------------------------------------------------------+--------------
Comment (by stefanfoulis):

 OK... I did some testing and was able to reproduce the condition. In a
 simple Model with a DurationField create a record in Admin and enter 0 as
 the value. django-admin will throw a ''' ''AttributeError'': 'Decimal'
 object has no attribute 'days' ''' and will prevent saving the
 value.[[BR]]
 If you enter 0 directly into the database or save a datetime.timedelta(0)
 from the django shell (which works, unlike in the admin) that attribute
 will return a Decimal("0") instead of the timedelta object (once you re-
 fetch it from the database).[[BR]]
 So my proposed patch to ''get_db_prep_save'' is the wrong place to fix
 this problem. It seems this condition is rooted where the data is
 converted from to database to the native python object.[[BR]]
 Could this have something to do with the backend driver doing the coercion
 to python types that was reported in #3982?[[BR]]
 I've been testing this with sqlite3 btw.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/2443#comment:13>
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