Last active
October 19, 2018 08:57
Revisions
-
chriskief revised this gist
Jan 13, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ ids = [9, 8, 1, 2, 7, 3] results = Model.objects.filter(id__in=ids).extra( select={'manual': 'FIELD(id,%s)' % ','.join(map(str, ids))}, order_by=['manual'] ) -
chriskief revised this gist
Jan 13, 2015 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ ids = [9, 8, 1, 2, 7, 3] addons = Model.objects.filter(id__in=ids).extra( select={'manual': 'FIELD(id,%s)' % ','.join(map(str, ids))}, order_by=['manual'] ) -
chriskief revised this gist
Jan 13, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ ids = [9, 8, 1, 2, 7, 3] addons = Model.objects.filter(id__in=ids).extra( select={'manual': 'FIELD(id,%s)' % ','.join(map(str, ids))}, order_by=['manual']) -
chriskief created this gist
Jan 13, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ ids = [a_list, of, ordered, ids] addons = Model.objects.filter(id__in=ids).extra( select={'manual': 'FIELD(id,%s)' % ','.join(map(str, ids))}, order_by=['manual'])