Replace handcoded query to queryset for T::all()