Change query time propagation handling

Previously, we were handling query time propagation by adding
where clauses.  However, this didn't work properly for certain
cases, like when using annotations.  Annotations create LEFT
OUTER JOIN clauses, and in some cases the only way to get the
correct results is to have the query time restriction specified
in the JOIN ON clause instead of the WHERE clause.

The code in this commit makes all the query time restriction happen
in the JOIN ON clauses.

It also eliminates the need to manually call propagate_querytime()
when traversing many-to-many relationships.