1👍
Maybe it’s because of null values, but because of that, it didn’t work for me.
I solved it using the F function by Django to have in count null values, like this:
from django.db.models import F
restaurants = Restaurants.objects.order_by(F('rating_average').desc(nulls_last=True))
Documentation by Django – link.
Source:stackexchange.com