[Django]-How to use a Django GenericRelation in a values_list query

2👍

That worked in Django < 1.6 but was untested and undocumented. There is a open ticket here.

For a workaround, you can do this:

ctype = ContentType.objects.get_for_model(Place)
pk_list = ItemOrigin.objects.filter(
    content_type=ctype
).values_list('object_id', flat=True)
places = Place.objects.filter(pk__in=pk_list)

Leave a comment