happenings/utils/calendars.py
def formatmonth(self, theyear, themonth, withyear=True, net=None, qs=None, template='happenings/partials/calendar/month_table.html'):
        """Return a formatted month as a table."""
        context = self.get_context()
        context['month_start_date'] = date(self.yr, self.mo, 1)
        context['week_rows'] = []
        for week in self.monthdays2calendar(theyear, themonth):
            week_row = []
            for day, weekday in week:
                week_row.append(self.formatday(day, weekday))
            context['week_rows'].append(week_row)

        nxt, prev = get_next_and_prev(net)
        extra_qs = ('&' + '&'.join(qs)) if qs else ''
        context['prev_qs'] = mark_safe('?cal_prev=%d%s' % (prev, extra_qs))
        context['next_qs'] = mark_safe('?cal_next=%d%s' % (nxt, extra_qs))
        context['withyear'] = withyear
        return render_to_string(template, context)
def formatmonth(self, theyear, themonth, withyear=True, net=None, qs=None, template='happenings/partials/calendar/month_table.html'):
        context = self.get_context()
        context['month_start_date'] = date(self.yr, self.mo, 1)
        context['week_rows'] = []
        for week in self.monthdays2calendar(theyear, themonth):
            week_row = []
            for day, weekday in week:
                week_row.append(self.formatday(day, weekday))
            context['week_rows'].append(week_row)

        nxt, prev = get_next_and_prev(net)
        extra_qs = ('&' + '&'.join(qs)) if qs else ''
        context['prev_qs'] = mark_safe('?cal_prev=%d%s' % (prev, extra_qs))
        context['next_qs'] = mark_safe('?cal_next=%d%s' % (nxt, extra_qs))
        context['withyear'] = withyear
        return render_to_string(template, context)
def formatmonth ( self , theyear , themonth , withyear = True , net = None , qs = None , template = 'happenings/partials/calendar/month_table.html' ) : context = self . get_context ( ) context [ 'month_start_date' ] = date ( self . yr , self . mo , 1 ) context [ 'week_rows' ] = [ ] for week in self . monthdays2calendar ( theyear , themonth ) : week_row = [ ] for day , weekday in week : week_row . append ( self . formatday ( day , weekday ) ) context [ 'week_rows' ] . append ( week_row ) nxt , prev = get_next_and_prev ( net ) extra_qs = ( '&' + '&' . join ( qs ) ) if qs else '' context [ 'prev_qs' ] = mark_safe ( '?cal_prev=%d%s' % ( prev , extra_qs ) ) context [ 'next_qs' ] = mark_safe ( '?cal_next=%d%s' % ( nxt , extra_qs ) ) context [ 'withyear' ] = withyear return render_to_string ( template , context )
Return a formatted month as a table.
Return a formatted month as a table .