[Fixed]-Is there a "proper" way to convert django.db.models.query.ValuesListQuerySet to a pure List?


Well, I’m not sure it’s proper, but it’s ridiculously simple to use list() to accomplish this:

picture_ids = list(picture_foreign_pictures.values_list('picture_id', flat=True))


Above solution is not working:

You can convert to pur list like this:

p_ids =PictureForeignPicture.objects.filter(picture_foreign__in=picture_foreigns).values_list('picture_id', flat=True)

new_list = [];new_list.extend(p_ids)

Leave a comment