Use localdate() instead of now() for default Timeline view date.

This commit is contained in:
Christopher Charbonneau Wells 2017-10-30 20:58:12 -04:00
parent 0d7382407c
commit b0d2fdd521
1 changed files with 3 additions and 2 deletions

View File

@ -92,14 +92,15 @@ class SleepTotalsChildReport(PermissionRequiredMixin, DetailView):
class TimelineChildReport(PermissionRequiredMixin, DetailView):
"""Graph of total sleep by day."""
"""Chronological daily view of events (non-graph).
"""
model = Child
permission_required = ('core.view_child',)
template_name = 'reports/timeline.html'
def get_context_data(self, **kwargs):
context = super(TimelineChildReport, self).get_context_data(**kwargs)
date = self.request.GET.get('date', str(timezone.now().date()))
date = self.request.GET.get('date', str(timezone.localdate()))
date = timezone.datetime.strptime(date, '%Y-%m-%d')
date = timezone.localtime(timezone.make_aware(date))
context['objects'] = timeline(self.object, date)