示例#1
0
 def update(self):
     super(ItemsScheduledViewlet, self).update()
     formatter = self.get_date_formatter("dateTime", "medium")
     for d in self.items:
         d["sittings_start"] = []
         d["sittings_status"] = []
         item_schedules = getActiveItemSchedule(d["id"])
         for item_schedule in item_schedules:
             s = item_schedule.sitting
             d["sittings_start"].append(formatter.format(s.start_date))
             d["sittings_status"].append(s.status)
         # past, present, future
         d["css_class"] = None
         if item_schedules:
             today = datetime.datetime.today().date()
             # take "last" sitting date
             startday = item_schedules[0].sitting.start_date.date()
             if today == startday:
                 d["css_class"] = "present"
             elif today > startday:
                 d["css_class"] = "past"
             else:
                 d["css_class"] = "future"
示例#2
0
 def update(self):
     super(ItemsScheduledViewlet, self).update()
     formatter = date.getLocaleFormatter(self.request, "dateTime", "medium")
     for d in self._data:
         d["sittings_start"] = []
         d["sittings_status"] = []
         items_schedule = getActiveItemSchedule(d["id"])
         for item_schedule in items_schedule:
             s = item_schedule.sitting
             d["sittings_start"].append(formatter.format(s.start_date))
             d["sittings_status"].append(s.status)
         # past, present, future
         d["css_class"] = None
         if items_schedule:
             today = datetime.datetime.today().date()
             # take "last" sitting date
             startday = items_schedule[0].sitting.start_date.date()
             if today==startday:
                 d["css_class"] = "present"
             elif today>startday:
                 d["css_class"] = "past"
             else:
                 d["css_class"] = "future"