Skip to content

Instantly share code, notes, and snippets.

@chriskief

chriskief/query.py

Last active Apr 1, 2017
Embed
What would you like to do?
from itertools import chain
from operator import attrgetter
# ascending oreder
result_list = sorted(
chain(queryset1, queryset2),
key=attrgetter('date_created'))
# descending order
result_list = sorted(
chain(queryset1, queryset2),
key=attrgetter('date_created'),
reverse=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment