title: Mongoengine AttributeError
body: <p>I'm trying to code authorization for app using Flask-Mongoengine and Flask-Login. And I'm getting this weird error:</p>
  
  <pre><code>File "/usr/lib/python3.5/site-packages/mongoengine/base/document.py", line 188, in __setattr__
      super(BaseDocument, self).__setattr__(name, value)
    File "/usr/lib/python3.5/site-packages/mongoengine/base/fields.py", line 132, in __set__
      if instance._initialised:
  AttributeError: _initialised
  </code></pre>
  
  <p>My models.py:</p>
  
  <pre><code>from app import app, db
  from flask.ext.login import LoginManager
  
  
  login_manager = LoginManager()
  login_manager.init_app(app)
  
  
  class User(db.Document):
      email = db.StringField(required=True)
      first_name = db.StringField(max_lenght=40, required=True)
      last_name = db.StringField(max_lenght=40, required=True)
      password = db.StringField(required=True)
  
      def __init__(self, email, first_name, last_name, password):
          self.email = email
          self.first_name = first_name
          self.last_name = last_name
          self.password = password
  
      def is_authenticated(self):
          return True
  
      def is_active(self):
          return True
  
      def is_anonymous(self):
          return False
  
     def get_id(self):
          return self.email
  </code></pre>
  
  <p>I've tried supering the class, but it didn't help. </p>
  
  <p><a href="https://github.com/MongoEngine/flask-mongoengine/issues/156" rel="nofollow">https://github.com/MongoEngine/flask-mongoengine/issues/156</a></p>