'Function that can be curried to provide the m2m table name for this relation'

def _get_m2m_db_table(self, opts):

    if (self.rel.through is not None):
        return self.rel.through._meta.db_table
    elif self.db_table:
        return self.db_table
    else:
        return util.truncate_name(('%s_%s' % (opts.db_table, self.name)), connection.ops.max_name_length())
