I have a "watch" model that lets users keep an eye on various things
through a generic relation:

class Watch(models.Model):
    subscriber = models.ForeignKey(User, verbose_name="Subscriber")
    content_type = models.ForeignKey(ContentType)
    content_object = generic.GenericForeignKey()
    object_id = models.IntegerField('object ID')
    created = models.DateTimeField(auto_now_add=True)


What I'm trying to do is get the most-watched objects.
I saw James Bennett's snippet from 2007 (http://djangosnippets.org/
snippets/108/) which looks like it would work (subbing my Watch model
for comments), but I'm wondering if there's a better way to do it with
newer versions of django, possibly through annotate or aggregate?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to