if output has_key paginate_by paginate_by output get paginate_by objec

1
2
3
4
5
6
7
8
9
if output.has_key('paginate_by'):
paginate_by = output.get('paginate_by')
object_list = output[paginate_by]
else:
for key in output:
if isinstance(output[key], QuerySet):
paginate_by = key
object_list = output[paginate_by]
break