Note that there are some explanatory texts on larger screens.

plurals
  1. POError : "Document BlogPost may not be subclassed" mongoengine
    text
    copied!<p>I am using pymongo version 2.6.1 with mongoengine 0.8.4. And I want to create one code using tutorial given in</p> <p>link <a href="https://mongoengine-odm.readthedocs.org/en/latest/tutorial.html" rel="nofollow">https://mongoengine-odm.readthedocs.org/en/latest/tutorial.html</a></p> <p>My code is as follows in sample.py file: </p> <pre><code>from mongoengine import * import datetime class BlogPost(Document): title = StringField(required=True, max_length=200) posted = DateTimeField(default=datetime.datetime.now) tags = ListField(StringField(max_length=50)) class TextPost(BlogPost): content = StringField(required=True) class LinkPost(BlogPost): url = StringField(required=True) </code></pre> <p>On terminal wnen I run , I get follwing error:</p> <p>Python 2.7.3 (default, Apr 10 2013, 05:46:21) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information.</p> <blockquote> <blockquote> <blockquote> <p>from sample import Post Traceback (most recent call last): File "", line 1, in File "sample.py", line 9, in class TextPost(BlogPost): File "/usr/local/lib/python2.7/dist-packages/mongoengine/base/metaclasses.py", line 332, in <strong>new</strong> new_class = super_new(cls, name, bases, attrs) File "/usr/local/lib/python2.7/dist-packages/mongoengine/base/metaclasses.py", line 120, in <strong>new</strong> base.<strong>name</strong>) <b>ValueError: Document BlogPost may not be subclassed</b></p> </blockquote> </blockquote> </blockquote> <p>Please help me. I also tried uninstall and reinstall. but it not works. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload