I calculated one variable using the annotate and now i want to compare it with the existing field. So how can I do that?
models.py
class Book(models.Model):
name = models.CharField(max_length=50)
price = models.IntegerField()
query is look like this
aggregate_query = {
"max-price": (
aggregate(Avg('price'))
)
}
input_queryset = Books.objects.annotate(**aggregate_query)
So now i want to improve the query to filter the data of those books whose price is below the max and more than the average value.