def get_context_data(self, **kwargs):
data = super(BaseCalendarMonthView, self).get_context_data(**kwargs)<EOL>year = self.get_year()<EOL>month = self.get_month()<EOL>date = _date_from_string(year, self.get_year_format(),<EOL>month, self.get_month_format())<EOL>cal = Calendar(self.get_first_of_week())<EOL>month_calendar = []<EOL>now = datetime.datetime.utcnow()<EOL>date_lists = defaultdict(list)<EOL>multidate_objs = []<EOL>for obj in data['<STR_LIT>']:<EOL><INDENT>obj_date = self.get_start_date(obj)<EOL>end_date_field = self.get_end_date_field()<EOL>if end_date_field:<EOL><INDENT>end_date = self.get_end_date(obj)<EOL>if end_date and end_date != obj_date:<EOL><INDENT>multidate_objs.append({<EOL>'<STR_LIT>': obj,<EOL>'<STR_LIT>': [x for x in daterange(obj_date, end_date)]<EOL>})<EOL>continue  <EOL><DEDENT><DEDENT>date_lists[obj_date].append(obj)<EOL><DEDENT>for week in cal.monthdatescalendar(date.year, date.month):<EOL><INDENT>week_range = set(daterange(week[<NUM_LIT:0>], week[<NUM_LIT:6>]))<EOL>week_events = []<EOL>for val in multidate_objs:<EOL><INDENT>intersect_length = len(week_range.intersection(val['<STR_LIT>']))<EOL>if intersect_length:<EOL><INDENT>slot = <NUM_LIT:1><EOL>width = intersect_length  <EOL>nowrap_previous = True  <EOL>nowrap_next = True  <EOL>if val['<STR_LIT>'][<NUM_LIT:0>] >= week[<NUM_LIT:0>]:<EOL><INDENT>slot = <NUM_LIT:1> + (val['<STR_LIT>'][<NUM_LIT:0>] - week[<NUM_LIT:0>]).days<EOL><DEDENT>else:<EOL><INDENT>nowrap_previous = False<EOL><DEDENT>if val['<STR_LIT>'][-<NUM_LIT:1>] > week[<NUM_LIT:6>]:<EOL><INDENT>nowrap_next = False<EOL><DEDENT>week_events.append({<EOL>'<STR_LIT>': val['<STR_LIT>'],<EOL>'<STR_LIT>': slot,<EOL>'<STR_LIT:width>': width,<EOL>'<STR_LIT>': nowrap_previous,<EOL>'<STR_LIT>': nowrap_next,<EOL>})<EOL><DEDENT><DEDENT>week_calendar = {<EOL>'<STR_LIT>': week_events,<EOL>'<STR_LIT>': [],<EOL>}<EOL>for day in week:<EOL><INDENT>week_calendar['<STR_LIT>'].append({<EOL>'<STR_LIT>': day,<EOL>'<STR_LIT>': date_lists[day],<EOL>'<STR_LIT>': day == now.date(),<EOL>'<STR_LIT>': day.month == date.month,<EOL>})<EOL><DEDENT>month_calendar.append(week_calendar)<EOL><DEDENT>data['<STR_LIT>'] = month_calendar<EOL>data['<STR_LIT>'] = [DAYS[x] for x in cal.iterweekdays()]<EOL>data['<STR_LIT>'] = date<EOL>data['<STR_LIT>'] = self.get_next_month(date)<EOL>data['<STR_LIT>'] = self.get_previous_month(date)<EOL>return data<EOL>
Injects variables necessary for rendering the calendar into the context.

Variables added are: `calendar`, `weekdays`, `month`, `next_month` and `previous_month`.