'Does any necessary class setup immediately prior to producing SQL. This
is for things that can\'t necessarily be done in __init__ because we
might not have all the pieces in place at that time.
# TODO: after the query has been executed, the altered state should be
# cleaned. We are not using a clone() of the query here.'

def pre_sql_setup(self):

    if (not self.query.tables):
        self.query.join((None, self.query.model._meta.db_table, None, None))
    if ((not self.query.select) and self.query.default_cols and (not self.query.included_inherited_models)):
        self.query.setup_inherited_models()
    if (self.query.select_related and (not self.query.related_select_cols)):
        self.fill_related_selections()
