Skip to content

Instantly share code, notes, and snippets.

@davedash
Created February 11, 2010 03:05
Show Gist options
  • Save davedash/301162 to your computer and use it in GitHub Desktop.
Save davedash/301162 to your computer and use it in GitHub Desktop.
ids = [a_list, of, ordered, ids]
addons = Addon.objects.filter(id__in=ids).extra(
select={'manual': 'FIELD(id,%s)' % ','.join(map(str,ids))},
order_by=['manual'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment