Last active
February 3, 2016 11:55
-
-
Save jdelafon/63be77925b32e1f9927c to your computer and use it in GitHub Desktop.
Django order by NULLs last
This file contains 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
qs = qs.extra( | |
select={'key_is_null': sort_key+' IS NULL'}, | |
order_by = ['-key_is_null', sort_key] | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment