#NEWLINE# @ register . simple_tag ( takes_context = True ) #NEWLINE# def show_calendar( context , req = None , mini = False , inherit_context = False ) : #NEWLINE# #INDENT# req = ( req or context . get ( 'request' , None ) ) #NEWLINE# if ( not ( req and hasattr ( inherit_context , 'path' ) and hasattr ( req , 'META' ) ) ) : #NEWLINE# #INDENT# raise TemplateSyntaxError ( '{% show_calendar %} should be called with HttpRequest instance as first argument or it should be available as `request` variable in template context' ) #NEWLINE# #UNINDENT# now = get_now ( ) #NEWLINE# ( net , category , tag ) = get_net_category_tag ( req ) #NEWLINE# year = now . year #NEWLINE# month = ( now . month + net ) #NEWLINE# ( year , month , error ) = clean_year_month ( year , month , None ) #NEWLINE# prefetch = { #NEWLINE# #INDENT# 'loc' : True , #NEWLINE# 'cncl' : True , #NEWLINE# #UNINDENT# } #NEWLINE# if mini : #NEWLINE# #INDENT# prefetch [ 'loc' ] = False #NEWLINE# #UNINDENT# all_month_events = list ( Event . objects . all_month_events ( year , month , category , tag , ** prefetch ) ) #NEWLINE# all_month_events . sort ( key = ( lambda x : x . l_start_date . hour ) ) #NEWLINE# qs = req . META [ 'QUERY_STRING' ] #NEWLINE# if qs : #NEWLINE# #INDENT# qs = get_qs ( qs ) #NEWLINE# #UNINDENT# if ( not inherit_context ) : #NEWLINE# #INDENT# context = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# return month_display ( year , month , all_month_events , start_day , net , qs , mini = mini , request = req , context = context )