views:

25

answers:

1

I'm trying to accomplish something like this:

  userSelectionIDs = [pref.selectionID for pref in UserColumnSelectionPreference.objects.filter(user=reqUser).all()]
  selections = ColumnSelections.objects.filter(id.in_(userSelectionIDs)).filter(type=2).all()

Or, is there a better way for me to get that set of objects?

+1  A: 

Sure:

selections = ColumnSelections.objects.filter(id__in(userSelectionIDs)).filter(type=2).all()

See the QuerySet API.

Dominic Rodger