I’m trying to do this query in django and I’m not sure what the best way to do it is. I neeed to group and then count and order by that count…
I have a through model like:
ProjectView(models.Model):
user = models.ForeignKey(User)
project = models.ForeignKey(Project)
datetime_created = models.DateTimeField()
I want to get a list of projects ordered by most views since yesterday.
Something like this (not tested):
Where
Projectis the model name andprojectviewis thethroughtable.