Esempio n. 1
0
def _prepare_timeline_context_data(context, date, child=None):
    date = timezone.datetime.strptime(date, "%Y-%m-%d")
    date = timezone.localtime(timezone.make_aware(date))
    context["timeline_objects"] = timeline.get_objects(date, child)
    context["date"] = date
    context["date_previous"] = date - timezone.timedelta(days=1)
    if date.date() < timezone.localdate():
        context["date_next"] = date + timezone.timedelta(days=1)
    pass
Esempio n. 2
0
 def get_context_data(self, **kwargs):
     context = super(ChildDetail, self).get_context_data(**kwargs)
     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['timeline_objects'] = timeline.get_objects(self.object, date)
     context['date'] = date
     context['date_previous'] = date - timezone.timedelta(days=1)
     if date.date() < timezone.localdate():
         context['date_next'] = date + timezone.timedelta(days=1)
     return context