<commit_before>#!/usr/bin/env python
# coding: utf-8

from .base import Column


class DatetimeColumn(Column):

    DEFAULT_FORMAT = "%Y-%m-%d %H:%I:%S"

    def __init__(self, field, header=None, format=None, **kwargs):
        self.format = format or DatetimeColumn.DEFAULT_FORMAT
        super(DatetimeColumn, self).__init__(field, header, **kwargs)

    def render(self, obj):
        datetime = super(DatetimeColumn, self).render(obj)
        return datetime.strftime(self.format)<commit_msg>Resolve object and do strftime first, fixes #21<commit_after>#!/usr/bin/env python
# coding: utf-8

from django.utils.html import escape
from table.utils import Accessor
from .base import Column


class DatetimeColumn(Column):

    DEFAULT_FORMAT = "%Y-%m-%d %H:%I:%S"

    def __init__(self, field, header=None, format=None, **kwargs):
        self.format = format or DatetimeColumn.DEFAULT_FORMAT
        super(DatetimeColumn, self).__init__(field, header, **kwargs)

    def render(self, obj):
        datetime = Accessor(self.field).resolve(obj)
        text = datetime.strftime(self.format)
        return escape(text)
{'fraction_non_alphanumeric': 0.12678571428571428, 'fraction_numerical': 0.0035714285714285713, 'mean_word_length': 3.831896551724138, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4800661', 'n_tokens_mistral': 352, 'n_tokens_neox': 336, 'n_words': 85}