Merge pull request #1918 from bagerard/improve_error_cant_subclass_document

Improve the error message that mentions that Document cant be subclassed
This commit is contained in:
erdenezul
2018-10-15 11:18:13 +08:00
committed by GitHub
2 changed files with 7 additions and 4 deletions

View File

@@ -121,7 +121,8 @@ class DocumentMetaclass(type):
# inheritance of classes where inheritance is set to False
allow_inheritance = base._meta.get('allow_inheritance')
if not allow_inheritance and not base._meta.get('abstract'):
raise ValueError('Document %s may not be subclassed' %
raise ValueError('Document %s may not be subclassed. '
'To enable inheritance, use the "allow_inheritance" meta attribute.' %
base.__name__)
# Get superclasses from last base superclass