Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Converts a list to a django queryset
def list_to_queryset(model_list):
if len(model_list) > 0:
return model_list[0].__class__.objects.filter(
pk__in=[ for obj in model_list])
return []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment