def calendar_by_periods(request, calendar_slug, periods=None, template_name='schedule/calendar_by_period.html'):
 calendar = get_object_or_404(Calendar, slug=calendar_slug)
 date = coerce_date_dict(request.GET)
 if date:
  try:
   date = datetime.datetime(**date)
  except ValueError:
   raise Http404
 else:
  date = datetime.datetime.now()
 event_list = GET_EVENTS_FUNC(request, calendar)
 period_objects = dict([(period.__name__.lower(), period(event_list, date)) for period in periods])
 return render_to_response(template_name, {'date': date, 'periods': period_objects, 'calendar': calendar, 'weekday_names': weekday_names, 'here': quote(request.get_full_path())}, context_instance=RequestContext(request))

def calendar_by_periods ( request , calendar_slug , periods = None , template_name = 'schedule/calendar_by_period.html' ) : calendar = get_object_or_404 ( Calendar , slug = calendar_slug ) date = coerce_date_dict ( request . GET ) if date : try : date = datetime . datetime ( ** date ) except ValueError : raise Http404 else : date = datetime . datetime . now ( ) event_list = GET_EVENTS_FUNC ( request , calendar ) period_objects = dict ( [ ( period . __name__ . lower ( ) , period ( event_list , date ) ) for period in periods ] ) return render_to_response ( template_name , { 'date' : date , 'periods' : period_objects , 'calendar' : calendar , 'weekday_names' : weekday_names , 'here' : quote ( request . get_full_path ( ) ) } , context_instance = RequestContext ( request ) )
this view is for getting a calendar .