#1584: [patch] auto_now_add fields set to NULL on update
------------------------------------------------+---------------------------
 Reporter:  Andy Dustman <[EMAIL PROTECTED]>  |        Owner:  adrian      
     Type:  defect                              |       Status:  new         
 Priority:  normal                              |    Milestone:  Version 0.92
Component:  Database wrapper                    |      Version:  SVN         
 Severity:  normal                              |   Resolution:              
 Keywords:                                      |  
------------------------------------------------+---------------------------
Comment (by lukeplant):

 The patch doesn't exactly fix it:  if you save an object n times, the
 datetime value will be set to the datetime at the last time you saved, not
 the first.  The problem is that the value is not being saved to the
 object.  The pre_save method cannot currently do this, since it doesn't
 have access to the object (pre_save is a method on a Field object and
 Field objects are essentially definitions that don't contain data -- the
 data itself is a member of the model class instance).
 
 The reason this is not normally a problem is that you normally discard' an
 object after saving it -- the next time it is used will be by another
 request, which will load it fresh from the database, and the datetime
 value will be set.
 
 The easiest way to fix it, as I see it, is to change the arguments of
 Field.pre_save() so that it takes a model instance instead of a value.
 I'll come up with a patch and check it with Adrian.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/1584>
Django <http://code.djangoproject.org/>
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates
-~----------~----~----~----~------~----~------~--~---

Reply via email to