[Answer]-Dash instead of the date of django-table

1👍

I found that column reference errors fail silently in django-tables2, and the dashes in the column (I’m assuming every field in the column is as a dash) is the way you know.

Posting your model would make it more helpful, but if you maybe want to set some other tables.Column stuff in your table definition, you could try changing:

date_from = tables.DateTimeColumn()
date_to = tables.DateTimeColumn()

to

date_from = tables.DateColumn()
date_to = tables.DateColumn()

If that doesn’t work, or if you don’t need to set any attribute in your table definition (and assuming that MyModel defines date_from and date_to) try just removing the two lines above so that you have

class MyTable(BaseTable):
    user = tables.Column(
        order_by=('user__last_name', 'user__first_name'),
        accessor='user.get_full_name',
        verbose_name=_('Worker')
    )

    class Meta(BaseTable.Meta):
        model = MyModel
        fields = ('user', 'country', 'date_from', 'date_to')

Leave a comment