def get_rating(self, obj): try: result = PaymentRequest.objects.filter( job_title__linked_job__service_provider_id=obj.id, rating__isnull=False ).aggregate(avg_rating=Avg("rating")) return result["avg_rating"] or 0 except Exception: return 0 explain this part

Aleem Gul's user avatar

New contributor

Aleem Gul is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.