class Log: project = ForeignKey(Project) msg = CharField(...) date = DateField(...)
I want to select the four most recent Log entries where each
I know this is an old post, but in Django 2.0, I think you could just use:
Log.objects.values('project').distinct().order_by('project')[:4]