Add filter_by helper for arbitrary filtering in templates