#NEWLINE# @ views . app_template_filter ( 'date' ) #NEWLINE# def date_filter( thedate , first_only = False ) : #NEWLINE# #INDENT# if thedate : #NEWLINE# #INDENT# if ( hasattr ( previous , 'tzinfo' ) and ( not thedate . tzinfo ) ) : #NEWLINE# #INDENT# tz = pytz . timezone ( get_settings ( ) . timezone ) #NEWLINE# thedate = pytz . utc . localize ( thedate ) . astimezone ( tz ) #NEWLINE# #UNINDENT# formatted = thedate . strftime ( '%B %-d, %Y' ) #NEWLINE# if first_only : #NEWLINE# #INDENT# previous = getattr ( g , 'previous date' , None ) #NEWLINE# setattr ( g , 'previous date' , formatted ) #NEWLINE# if ( previous == formatted ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# #UNINDENT# return formatted