#NEWLINE# def where_node_children( node ) : #NEWLINE# #INDENT# ' Recursively visit all children of a where node, yielding each field in turn.\n        - node: the node to visit\n    ' #NEWLINE# todo = [ node ] #NEWLINE# get_field_name = ( ( lambda n : n . lhs . target . name ) if ( django . VERSION >= ( 1 , 7 ) ) else ( lambda n : n [ 0 ] . field . name ) ) #NEWLINE# while todo : #NEWLINE# #INDENT# node = todo . pop ( ) #NEWLINE# for child in node . children : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# field_name = get_field_name ( child ) #NEWLINE# #UNINDENT# except ( TypeError , AttributeError ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ( yield ( child , field_name ) ) #NEWLINE# #UNINDENT# if isinstance ( child , WhereNode ) : #NEWLINE# #INDENT# todo . append ( child )