I'm need annotation each object in queryset. I used annotation, but when return modified object, I get this error:
Cannot resolve expression type, unknown output_field.
How can I solve this problem?
def get_queryset(self):
get_cinema = Ciname.objects.filter(active_cinema='t')
distation = 54.87 #for example
queryset = get_cinema.annotate(distance=models.Max(distation))
return queryset
You might need to add an output_field to your annotation:
queryset = get_cinema.annotate(distance=models.Max(distation, output_field=models.FloatField()))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With