iepy icon indicating copy to clipboard operation
iepy copied to clipboard

cannot inherit from IEDocument

Open francolq opened this issue 10 years ago • 2 comments

In my own app I am trying to subclass IEDocument to have additional fields and methods, but mongoengine says I can't do it. Not sure if bug or design decision, but it would be useful in my case to be able to subclass IEDocument.

For instance:

from iepy.models import IEDocument class MyDocument(IEDocument): ... pass ... Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python2.7/dist-packages/mongoengine/base/metaclasses.py", line 332, in new new_class = super_new(cls, name, bases, attrs) File "/usr/local/lib/python2.7/dist-packages/mongoengine/base/metaclasses.py", line 120, in new base.name) ValueError: Document IEDocument may not be subclassed

francolq avatar Jul 16 '14 22:07 francolq

Mongo is not the ORM used anymore, but Django instead.

Anyway, it will be still not very easy to do it. It's more a design consequence than a strong design decision.

jmansilla avatar Nov 04 '14 14:11 jmansilla

I see. At least, Django will allow subclassing. I am still interested in doing this, so I may be soon commenting on this.

francolq avatar Nov 04 '14 15:11 francolq