I am trying to convert a list of strings ( parenthesis, AND, OR ) and Q Expression into Q Expression. I have tried many things but still couldn't find a solution.
The input list looks like
['(', <Q: (NOT (AND: ('name', 'XYZ')))>, ')', 'AND', '(', '(', <Q: (AND: ('dob__gt', datetime.date(2020, 4, 4)))>, ')', 'OR', '(', <Q: (AND: ('no_of_degree__lt', 3))>, ')', ')']
And Desire output is
( ~Q( name = 'XYZ' )) & ( (Q(dob = 2020-04-04)) | (Q(no_of_degree = 3)) )
Any Idea how to do this?