#NEWLINE# def as_sql( self , compiler , connection ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# lhs_output = self . lhs . output_field #NEWLINE# #UNINDENT# except FieldError : #NEWLINE# #INDENT# lhs_output = None #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# rhs_output = self . rhs . output_field #NEWLINE# #UNINDENT# except FieldError : #NEWLINE# #INDENT# rhs_output = None #NEWLINE# #UNINDENT# if ( ( not connection . features . has_native_duration_field ) and ( ( lhs_output and ( lhs_output . get_internal_type ( ) == 'DurationField' ) ) or ( rhs_output and ( rhs_output . get_internal_type ( ) == 'DurationField' ) ) ) ) : #NEWLINE# #INDENT# return DurationExpression ( self . lhs , self . connector , self . rhs ) . as_sql ( compiler , connection ) #NEWLINE# #UNINDENT# if ( lhs_output and rhs_output and ( self . connector == self . SUB ) and ( lhs_output . get_internal_type ( ) in { 'DateField' , 'DateTimeField' , 'TimeField' } ) and ( lhs_output . get_internal_type ( ) == lhs_output . get_internal_type ( ) ) ) : #NEWLINE# #INDENT# return TemporalSubtraction ( self . lhs , self . rhs ) . as_sql ( compiler , connection ) #NEWLINE# #UNINDENT# expressions = [ ] #NEWLINE# expression_params = [ ] #NEWLINE# ( sql , params ) = compiler . compile ( self . lhs ) #NEWLINE# expressions . append ( sql ) #NEWLINE# expression_params . extend ( params ) #NEWLINE# ( sql , params ) = compiler . compile ( self . rhs ) #NEWLINE# expressions . append ( sql ) #NEWLINE# expression_params . extend ( params ) #NEWLINE# expression_wrapper = '(%s)' #NEWLINE# sql = connection . ops . combine_expression ( self . connector , expressions ) #NEWLINE# return ( ( expression_wrapper % sql ) , expression_params )