Last active
August 29, 2015 14:05
-
-
Save astyfx/391e4d7216d88318f99e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
filtered = [x['min_field'] for x in Model.objects.filter(filter_conditions).values('same_field').annotate(Count('same_field', distinct=True)).annotate(min_field=Min('min_field')).distinct()] | |
result = Model.objects.filter(field__in=filtered) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment