jieter / django-tables2

django-tables2 - An app for creating HTML tables

Home Page:https://django-tables2.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using linkify breaks DateTimeField values

swell-d opened this issue · comments

model:

class BaseModel(models.Model):
    created = models.DateTimeField(auto_now_add=True)

table:

class BaseTable(tables.Table):
    class Meta():
        model = BaseModel
        fields = 'created',

    created = tables.Column(linkify=('url', [tables.A("pk")]))

without linkify i have: "08.04.2022 15:51"
with: "2022-04-08 13:51:24.920317+00:00"

You should use tables.DateTimeColumn(linkify=...) to define the column. That is also wat django-tables2 uses when deriving the table off of your model class.