'django aggregate between 2 different querysets

So I have 2 query sets that are from the same model but different records. I already made the pythonic way of getting the result. but I want to do it with aggregate and annotate to get this done.

result = [i for i in self.old_searches if round(
abs(same_keys.get(keyword =i.keyword).current_position-i.current_position)) >=1]

so both of self.old_searches and same_keys have the same field called current_position and for example I need first recprd of the first query be compared with first record second one. but all i need is the current_position.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source