platform = StringField(max_length=20, required=True)
index = StringField(max_length=80)
last_updated = DateTimeField(required=True, default=datetime.now())
meta = {'collection': 'social_users'}

@classmethod
def pre_save(cls, sender, document, **kwargs):
    if document.platform and document.uid:
        document.index = document.platform + '/' + document.uid
signals.pre_save.connect(User.pre_save, sender=User)
Сигналы Mongoengine прослушиваются для всех моделей