Question

I'm working through the django-tables2 tutorial, and all works great except when I try to display my database model that has a TimeField or DateField defined in my Django model the column header is displayed but all data values are just shown as -.

An example row of my database begins:

Id          event_time  event_date  ...
----------  ----------  ----------  
1           13:41:41    2014-02-12  ...

and the template I am using is the very simple one from the tutorial with just {% render_table table %}. Do I need to do something else to get django-tables2 to show time and date values?

EDIT:

I also tried:

event_time = tables.DateTimeColumn(verbose_name="What time?")
event_date = tables.DateColumn(verbose_name="What date?")

in the tables.py class, but still not change in displaying the values, unless I change the model fields to be CharField.

Models.py

class A(models.Model):
    event_date = models.DateField('date of event')

tables.py

 class ATable(tables.Table):
     event_date = tables.DateColumn(verbose_name="What date?")
     ###event_date = tables.Column(verbose_name="What date?") <---THIS WORKS FINE

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top