@classmethod
    def get_bulk_action_ids(cls, scope, ids, omit_ids=[],
                            query=''):
        omit_ids = map(str, omit_ids)

        if scope == 'all_search_results':
            # Change the scope to go from selected ids to all search results.
            ids = cls.query.with_entities(cls.id).filter(cls.search(query))

            # SQLAlchemy returns back a list of tuples, we want a list of strs.
            ids = [str(item[0]) for item in ids]

        # Remove 1 or more items from the list, this could be useful in spots
        # where you may want to protect the current user from deleting himself
        # when bulk deleting user accounts.
        if omit_ids:
            ids = [id for id in ids if id not in omit_ids]

        return ids
Determine which IDs are to be modified.
dataset/ETHPy150Open nickjj/build-a-saas-app-with-flask/catwatch/lib/util_sqlalchemy.py/ResourceMixin.get_bulk_action_ids