'Returns class_name in underscored form, with "_id" tacked on at the end.
This is for use in dealing with the database.'

def foreignKey(self, class_name, separate_class_name_and_id_with_underscore=1):

    if separate_class_name_and_id_with_underscore:
        tail = '_id'
    else:
        tail = 'id'
    return (self.underscore(self.demodulize(class_name)) + tail)
