I have these models:
class Customer(models.Model):
customer_name = models.CharField(max_length=100)
def __unicode__(self):
return self.customer_name
class Feedback(models.Model):
customer_name = models.ForeignKey(Customer)
feedback_string = models.CharField(max_length=100)
def __unicode__(self):
return self.feedback_string
I want to get the name of customer who has used a particular keyword(for example: "good") maximum times in his/her all the feedbacks. (each feedback contain the particular word only once.)
I think this should work:
Here's the idea:
customer_name
from that listannotate
the list by counting just thecustomer_name
s