Need help adding a count to the queryset model

Im trying to add a count to the following queryset code in django.

query.communityRating = int(query.communityRating) + value          
   query.communityCount = query.communityCount + 1          
    query.save()
    
and then when we pass the score, to the template 

 if query.communityRating != 0:
        comRating = query.communityRating / query.communityCount
    else:
        comRating = query.communityRating
Back to Top