DJANGO
i have this model
and i am using a django package for star rating that uses this model
the two models are connected by the id that is created by default for every django model, where photo has the id field and the Rating table has the Object id field that i assume referenced this. I am trying to create a view that will order the photos by the average rating rather than just by the order that they are entered into the database.
here is the view i currently use to display them by default
class PhotoListView(ListView):
model = Photo
template_name = 'photoapp/list.html'
context_object_name = ‘photos’
i am unsure wether i need a new view or if i need some sort of loop in my html files that orders them by average rating. Any help would be appreciated.