filter in query instead of list comprehension

no need to query all rows; more efficient to use a queryset filter.