def formatday(
            self, day, weekday,
            day_template='happenings/partials/calendar/day_cell.html',
            noday_template='happenings/partials/calendar/day_noday_cell.html',
            popover_template='happenings/partials/calendar/popover.html',
            ):
        """Return a day as a table cell."""
        super(EventCalendar, self).formatday(day, weekday)
        now = get_now()
        context = self.get_context()
        context['events'] = []
        context['day'] = day
        context['day_url'] = self.get_day_url(day)
        context['month_start_date'] = date(self.yr, self.mo, 1)
        context['weekday'] = weekday
        context['cssclass'] = self.cssclasses[weekday]
        context['popover_template'] = popover_template
        context['num_events'] = len(self.count.get(day, [])),
        try:
            processed_date = date(self.yr, self.mo, day)
        except __HOLE__:
            # day is out of range for month
            processed_date = None

        context['month_start_date'] = date(self.yr, self.mo, 1)

        if day == 0:
            template = noday_template
        else:
            template = day_template

        if now.date() == processed_date:
            context['is_current_day'] = True

        if processed_date and (day in self.count):
            for item in self.count[day]:
                self.pk = item[1]
                self.title = item[0]
                for event in self.events:
                    if event.pk == self.pk:
                        event.check_if_cancelled(processed_date)
                        # allow to use event.last_check_if_cancelled and populate event.title.extra

                        context['events'].append(event)

        return render_to_string(template, context)
dataset/ETHPy150Open wreckage/django-happenings/happenings/utils/calendars.py/EventCalendar.formatday