Skip to content

Instantly share code, notes, and snippets.

@chriskief chriskief/
Last active Oct 19, 2018

What would you like to do?
ids = [9, 8, 1, 2, 7, 3]
results = Model.objects.filter(id__in=ids).extra(
select={'manual': 'FIELD(id,%s)' % ','.join(map(str, ids))},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.