Ralph Bean  committed 2b895e3

Better datetime formatting support.

  • Participants
  • Parent commits afef9d9
  • Branches default

Comments (0)

Files changed (1)

File tw2/jqplugins/jqgrid/widgets/

 from tw2.jqplugins.jqgrid.widgets.core import jqGridWidget
 import simplejson
+import datetime
 import math
 COUNT_PREFIX = '__count_'
     entity = tw2.core.Param("sqlalchemy class to render", request_local=False)
     excluded_columns = tw2.core.Param(
         "list of names of columns to be excluded", default=[])
+    datetime_format = tw2.core.Param(
+        "format string for formatting datetime objects", default="%x")
     show_relations = tw2.core.Param("(bool) show relationships?", default=True)
     show_attributes = tw2.core.Param("(bool) show attributes?", default=True)
             elif is_relation(prop) and not prop.uselist:
                 data = unicode(data)
-            if hasattr(data, 'isoformat'):
-                data = data.isoformat()
+            if isinstance(data, datetime.datetime):
+                data = data.strftime(cls.datetime_format)
             return data
         return [massage(entry, prop) for prop in cls._get_properties()]