i have a dayarchiveview in my django views.py file
class day_archive(DayArchiveView):
model=Timer
paginate_by=12
allow_future =True
allow_empty=True
month_format = '%m'
day_format='%d'
date_field='start_hour'
template_name='timer/timer_archive_date'
def get_queryset(self):
return Timer.objects.filter(author=self.request.user)
but i would like to render the data returned as a table using djangotables2 with something like this:
import django_tables2 as tables
class Job_table(tables.Table):
class Meta:
model = Timer
attrs = {"class": "paleblue"}
fields= ('start_hour','end_hour','category','subcategory','duration')
def render_duration(self,value):
from timehuman import sectohour
hh= sectohour(value)
return hh
how would i render my data as a table instead of the list rendered? ( context object_list by django) how do i access the data thats going to be sent to the object_list context and modify it?
This is what i ended up doing:
may be hackish, but i gives me access to the same data that’s going to the view and i can get to render it as a table.