#NEWLINE# def render( self , name , value , attrs = None ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# ( year_val , month_val , day_val ) = ( value . year , value . month , value . day ) #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# year_val = month_val = day_val = None #NEWLINE# if isinstance ( value , six . string_types ) : #NEWLINE# #INDENT# if settings . USE_L10N : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# input_format = get_format ( 'DATE_INPUT_FORMATS' ) [ 0 ] #NEWLINE# v = datetime . datetime . strptime ( value , input_format ) #NEWLINE# ( year_val , month_val , day_val ) = ( v . year , v . month , v . day ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# match = RE_DATE . match ( value ) #NEWLINE# if match : #NEWLINE# #INDENT# ( year_val , month_val , day_val ) = [ int ( v ) for v in match . groups ( ) ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# choices = [ ( i , i ) for i in self . years ] #NEWLINE# year_html = self . create_select ( value , self . year_field , value , year_val , choices ) #NEWLINE# choices = list ( six . iteritems ( MONTHS ) ) #NEWLINE# month_html = self . create_select ( name , self . month_field , value , month_val , choices ) #NEWLINE# choices = [ ( i , i ) for i in range ( 1 , 32 ) ] #NEWLINE# day_html = self . create_select ( name , self . day_field , value , day_val , choices ) #NEWLINE# output = [ ] #NEWLINE# for field in _parse_date_fmt ( ) : #NEWLINE# #INDENT# if ( field == 'year' ) : #NEWLINE# #INDENT# output . append ( year_html ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( field == 'month' ) : #NEWLINE# #INDENT# output . append ( month_html ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( field == 'day' ) : #NEWLINE# #INDENT# output . append ( day_html ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return mark_safe ( '\n' . join ( output ) )