#NEWLINE# def _check_date_hierarchy( self , obj ) : #NEWLINE# #INDENT# ' Check that date_hierarchy refers to DateField or DateTimeField. ' #NEWLINE# if ( obj . date_hierarchy is None ) : #NEWLINE# #INDENT# return [ ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# field = obj . model . _meta . get_field ( obj . date_hierarchy ) #NEWLINE# #UNINDENT# except FieldDoesNotExist : #NEWLINE# #INDENT# return refer_to_missing_field ( option = 'date_hierarchy' , field = obj . date_hierarchy , model = obj . model , obj = obj , id = 'admin.E127' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not isinstance ( field , ( models . DateField , models . DateTimeField ) ) ) : #NEWLINE# #INDENT# return must_be ( 'a DateField or DateTimeField' , option = 'date_hierarchy' , obj = obj , id = 'admin.E128' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return [ ]