Add support for prefixing query expressions

Review Request #7774 — Created Nov. 17, 2015 and submitted — Latest diff uploaded

Information

Djblets
master
850d88a...

Reviewers

A new utility method, prefix_q, has been added to facilitate
prefixing of query expressions. Query expressions, or (Q()
expressions) are Django's way of building the WHERE (and related)
clauses when querying for models.

If a foreign key fk exists from a model A to B (that is, A.fk
points at an instance of B), then a query expression that is used
to filter instances of B can be used with A via prefix_q:

q_a = prefix_q('fk', q_b)

This allows complex queries that select one model to be reused to
select related models very easily.

Ran unit tests.