Source

openju / openju / model.py

# -*- coding: utf-8 -*-

import datetime
from mongoengine import *

class User(Document):
    jid = StringField(max_length=200, required=True, unique=True)
    nick = StringField(max_length=200, required=True, unique=True)

class Message(Document):
    user = ReferenceField(User, required=True)
    body = StringField(required=True)
    dt = DateTimeField(default=datetime.datetime.utcnow, required=True)
    tags = ListField(StringField(max_length=50))
    reply_to = ReferenceField('self')
    
    meta = {
        'ordering': ['-dt']
    }