Skip to content

Instantly share code, notes, and snippets.

@douglasmiranda
Created March 6, 2012 22:13
Show Gist options
  • Save douglasmiranda/1989346 to your computer and use it in GitHub Desktop.
Save douglasmiranda/1989346 to your computer and use it in GitHub Desktop.
Django: extract pks from a db object in to a list of integers
def extract_pks(objects):
return [int(value.get('pk')) for value in objects.values('pk')]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment