[Fixed]-Django. Complex annotations require an alias. What is alias here?

20👍

You need to give a name to the result of Min, since Django wouldn’t be able to derive the name for complex aggregate functions:

max_min_price = MyModel.objects.annotate(min_price=Min('price', Max('price')))

Leave a comment