This is my model class courses(models.Model): cid = models.UUIDField(default=uuid.uuid4, editable=True, primary_key=True) course_title = models.CharField(max_length=255, default="")
class course_rating(models.Model): cr_id = models.BigAutoField(primary_key=True) cid = models.ForeignKey(courses,on_delete=models.CASCADE) userid = models.ForeignKey(settings.AUTH_USER_MODEL,on_delete=models.CASCADE) rating = models.IntegerField(validators[MaxValueValidator(5),MinValueValidator(1)],default=1) I want to fetch the course_title and cid from courses tables and want to perform the average rating of courses Can someone write the query set for the same -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPjsHcHXqr8%2Bnr91tA2Og%3DKpjeVGp8%2BFP%2BmsX9dbzuZxA5CHww%40mail.gmail.com.