Пример #1
0
class Post2(mongo_db.Document):
    created_at = mongo_db.DateTimeField(default=datetime.datetime.now,
                                        required=True)
    title = mongo_db.StringField(max_length=255, required=True)
    slug = mongo_db.StringField(max_length=255, required=True)
    body = mongo_db.StringField(required=True)
    comments = mongo_db.ListField(mongo_db.EmbeddedDocumentField('Comment'))

    def get_absolute_url(self):
        return url_for('post', kwargs={"slug": self.slug})

    def __unicode__(self):
        return self.title

    meta = {
        'allow_inheritance': True,
        'indexes': ['-created_at', 'slug'],
        'ordering': ['-created_at']
    }
Пример #2
0
class Events(mongo_db.Document):
    created_at = mongo_db.DateTimeField(default=datetime.datetime.now,
                                        required=True)
    comments = mongo_db.ListField(mongo_db.EmbeddedDocumentField('Comment'))
Пример #3
0
class EventCategories(mongo_db.Document):
    created_at = mongo_db.DateTimeField(default=datetime.datetime.now,
                                        required=True)
    name = mongo_db.StringField(max_length=255, required=True)
    description = mongo_db.StringField(max_length=255, required=True)
Пример #4
0
class Event(mongo_db.Document):
    created_at = mongo_db.DateTimeField(default=datetime.datetime.now,
                                        required=True)
    comments = mongo_db.ListField(mongo_db.EmbeddedDocumentField('Comment'))
    event_type = mongo_db.StringField(max_length=255, required=True)
Пример #5
0
class Glucose(mongo_db.Document):
    created_at = mongo_db.DateTimeField(default=datetime.datetime.now,
                                        required=True)
    comments = mongo_db.ListField(mongo_db.EmbeddedDocumentField('Comment'))
    user_id = mongo_db.StringField(max_length=24, required=True)
    reading = mongo_db.IntField(required=True)
Пример #6
0
class UserSession(mongo_db.Document):
    exp_time = datetime.datetime.now() + datetime.timedelta(minutes=60)
    sid = mongo_db.StringField(primary_key=True, default=str(uuid.uuid4()))
    created_at = mongo_db.DateTimeField(default=datetime.datetime.now)
    user_id = mongo_db.StringField(max_length=24, required=True)
    expiration = mongo_db.DateTimeField(default=exp_time)
Пример #7
0
class User(mongo_db.Document):
    created_at = mongo_db.DateTimeField(default=datetime.datetime.now)
    fname = mongo_db.StringField(max_length=64, required=True)
    lname = mongo_db.StringField(max_length=64, required=True)
    email = mongo_db.StringField(max_length=255, required=True)
    fb_id = mongo_db.IntField()