def expand(self, model=None, ignoreFilter=False):
queries = []<EOL>current_records = None<EOL>for query in self.__queries:<EOL><INDENT>sub_q = query.expand(model)<EOL>if not sub_q:<EOL><INDENT>continue<EOL><DEDENT>if ((isinstance(sub_q, orb.Query) and isinstance(sub_q.value(), orb.Query)) and<EOL>sub_q.value().model(model) != sub_q.model(model)):<EOL><INDENT>sub_model = sub_q.value().model(model)<EOL>sub_col = sub_q.value().column()<EOL>new_records = sub_model.select(columns=[sub_col])<EOL>sub_q = sub_q.copy()<EOL>sub_q.setOp(sub_q.Op.IsIn)<EOL>sub_q.setValue(new_records)<EOL>if current_records is not None and current_records.model() == sub_q.model(model):<EOL><INDENT>new_records = new_records.refine(createNew=False, where=sub_q)<EOL><DEDENT>else:<EOL><INDENT>queries.append(sub_q)<EOL><DEDENT>current_records = new_records<EOL><DEDENT>elif (current_records is not None and<EOL>(<EOL>(isinstance(sub_q, orb.Query) and current_records.model() == query.model(model)) or<EOL>(isinstance(sub_q, orb.QueryCompound) and current_records.model() in sub_q.models(model))<EOL>)):<EOL><INDENT>current_records.refine(createNew=False, where=sub_q)<EOL><DEDENT>else:<EOL><INDENT>current_records = None<EOL>queries.append(query)<EOL><DEDENT><DEDENT>return QueryCompound(*queries, op=self.op())<EOL>
Expands any shortcuts that were created for this query.  Shortcuts
provide the user access to joined methods using the '.' accessor to
access individual columns for referenced tables.

:param      model | <orb.Model>

:usage      |>>> from orb import Query as Q
            |>>> # lookup the 'username' of foreign key 'user'
            |>>> Q('user.username') == 'bob.smith'

:return     <orb.Query> || <orb.QueryCompound>