'Get the joins required for this filter
@param left: get the left joins
@param as_list: return a flat list rather than a nested dict'

def get_joins(self, left=False, as_list=True):

    if (self.query is None):
        self.get_query()
    joins = dict((self.ljoins if left else self.ijoins))
    resource = self.resource
    for q in self.filters:
        subjoins = q._joins(resource, left=left)[0]
        joins.update(subjoins)
    parent = resource.parent
    if parent:
        pf = parent.rfilter
        if (pf is None):
            pf = parent.build_query()
        parent_left = pf.get_joins(left=True, as_list=False)
        if parent_left:
            tablename = resource._alias
            if left:
                for tn in parent_left:
                    if ((tn not in joins) and (tn != tablename)):
                        joins[tn] = parent_left[tn]
                joins[parent._alias] = resource._join(reverse=True)
            else:
                joins.pop(parent._alias, None)
    if as_list:
        return [j for tablename in joins for j in joins[tablename]]
    else:
        return joins
