Am 23.02.2006 um 11:04 schrieb Robert Wittams:
> * The hack fields like auto_now and auto_now_add will need a  
> rethink. I
> really don't have much of an idea what you can do to make these
> sensible. Some callback on .save() maybe.

I've been wondering about this one... SQLObject allows you to use a  
function for the default value, the equivalent in Django would be:

   created = models.DateTimeField(default=datetime.now, editable=False)

The function is invoked when the object is prepared for insertion.  
This would be a cleaner and more general approach to implementing  
auto_now_add behavior IMHO.

Of course that doesn't address auto_now, but personally I wouldn't  
have a problem with updating such a timestamp field in the overridden  
save() method.

Cheers,
Chris
--
Christopher Lenz
   cmlenz at gmx.de
   http://www.cmlenz.net/


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@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-developers
-~----------~----~----~----~------~----~------~--~---

Reply via email to