Skip to content

Instantly share code, notes, and snippets.

@jpadilla
Created December 5, 2012 00:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpadilla/4210782 to your computer and use it in GitHub Desktop.
Save jpadilla/4210782 to your computer and use it in GitHub Desktop.
all_projects = Project.objects.select_related().filter(
company=company).order_by('-date_due')
q = all_projects.extra(select={'date_due_null': 'date_due is null'})
q = q.extra(order_by=['date_due_null'])
print q.query
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment