from django.core.exceptions import ValidationError

NAME_BLACKLIST = [
    'user',
    'users',
    'admin',
    'admins',
    'experiment',
    'experiments',
    'experiment_group',
    'experiment_groups',
    'project',
    'projects',
    'api',
    'polyaxon',
    'dashboard',
    'index',
    'log',
    'logs',
    'metric',
    'metrics',
    'perspectives',
    'portfolio',
    'public',
    'revision',
    'revisions',
    'version',
    'versions',
    'support',
    'tryout',
    'repo',
    'repos',
    'cluster',
    'event',
    'events',
]


def validate_blacklist_name(name):
    """Validates slug name against a blacklist"""
    if name is None:
        raise ValidationError('A short name must be supplied.')

    if name in NAME_BLACKLIST:
        raise ValidationError('The short name is a reserved word or already taken.')

from django.core.exceptions import ValidationError

NAME_BLACKLIST = {
    'user',
    'admin',
    'experiment',
    'experiment_group',
    'experimentgroup',
    'project',
    'api',
    'polyaxon',
    'dashboard',
    'index',
    'log',
    'metric',
    'portfolio',
    'public',
    'revision',
    'version',
    'support',
    'tryout',
    'repo',
    'cluster',
    'event',
    'manage',
    'login',
    'account',
    'register',
    'accept',
    'organization',
    'team',
    'help',
    'doc',
    'logout',
    '404',
    '500',
    'static',
    '_static',
    'out',
    'debug',
    'remote',
    'cli',
    'blog',
    'welcome',
    'feature',
    'customer',
    'integration',
    'signup',
    'pricing',
    'subscribe',
    'enterprise',
    'about',
    'job',
    'thank',
    'guide',
    'privacy',
    'security',
    'term',
    'from',
    'sponsorship',
    'for',
    'at',
    'platform',
    'branding',
    'vs',
    'answers',
    '_admin',
    'support',
    'contact',
    'ext',
    'extension',
    'plugin',
    'monitor',
    'setting',
    'legal',
    'avatar',
}
NAME_BLACKLIST |= {'{}s'.format(b) for b in NAME_BLACKLIST}


def validate_blacklist_name(name):
    """Validates slug name against a blacklist"""
    if name is None:
        raise ValidationError('A short name must be supplied.')

    if name in NAME_BLACKLIST:
        raise ValidationError('The short name is a reserved word or already taken.')

Update blacklist names