Say I have a Comment Model like this:
class Comment(models.Model):
user = models.ForeignKey(User)
content = models.CharField(max_length=200)
create_time = models.DateTimeField(blank=True, default=datetime.datetime.now)
content_type = models.ForeignKey(ContentType, verbose_name=_('content type'))
object_id = models.PositiveIntegerField(_('object id'), db_index=True)
object = generic.GenericForeignKey('content_type', 'object_id')
If it's possible for me to select latest several comments for multiple objects in the same content_type (say Posts, giving ids of those Posts) in one query?
If that's possible, how about select the oldest comment and latest 4 comments for those objects all in one query?
Thx!