def __new__(cls, name, bases, attrs):
        super_new = super(ViewMixinMetaclass, cls).__new__
        parents = [
            b for b in bases if isinstance(b, ViewMixinMetaclass) and
            not (b.__name__ == 'NewBase' and b.__mro__ == (b, object))
        ]
        if not parents:
            return super_new(cls, name, bases, attrs)

        # Create the class.
        new_cls = super_new(cls, name, bases, attrs)

        # validation
        if not hasattr(new_cls, 'model'):
            raise ImproperlyConfigured('No model attribute defined in %s.' % new_cls)

        if not hasattr(new_cls, 'slug'):
            raise ImproperlyConfigured('No slug attribute defined in %s.' % new_cls)

        if not hasattr(new_cls, 'name'):
            raise ImproperlyConfigured('No name attribute defined in %s.' % new_cls)

        if not re.match('^[\w-]+$', new_cls.slug):
            raise ImproperlyConfigured('The slug attribute defined in %s contains invalid chars.' % new_cls)

        # we add a key to add a unique identifier
        # the key is equal to the slug (for now) but this
        # gives us the opportunity to add i18n urls later
        if not hasattr(new_cls, 'key'):
            new_cls.key = new_cls.slug

        return new_cls
dataset/ETHPy150Open django-bmf/django-bmf/djangobmf/core/viewmixin.py/ViewMixinMetaclass.__new__/original