Permalink
Browse files

Updated DateProperty to auto-convert from datetime

  • Loading branch information...
1 parent 9967ff1 commit 33873ac2f4e7fb3f65cb1f86803d32cf8ac1181f Chris Moyer committed Feb 9, 2011
Showing with 4 additions and 1 deletion.
  1. +4 −1 boto/sdb/db/property.py
@@ -378,7 +378,10 @@ def validate(self, value):
def get_value_for_datastore(self, model_instance):
if self.auto_now:
setattr(model_instance, self.name, self.now())
- return Property.get_value_for_datastore(self, model_instance)
+ val = Property.get_value_for_datastore(self, model_instance)
+ if isinstance(val, datetime.datetime):
+ val = val.date()
+ return val
def now(self):
return datetime.date.today()

0 comments on commit 33873ac

Please sign in to comment.