+
+ def value_from_object(self, obj):
+ value = super(JSONAttribute, self).value_from_object(obj)
+ if isinstance(self.field_template, (models.DateField, models.DateTimeField)):
+ value = self.field_template.to_python(value)
+ return value
+
+ def get_storage_value(self, value):
+ if isinstance(value, datetime.datetime):
+ return value.strftime("%Y-%m-%d %H:%M:%S")
+ if isinstance(value, datetime.date):
+ return value.strftime("%Y-%m-%d")
+ return value