예제 #1
0
class Comment(db.DynamicDocument):
    description = db.StringField()
    post = db.ReferenceField('Post')
    created_at = db.DateTimeField(required=True, default=datetime.utcnow)
    user_id = db.ReferenceField(User)  # here will store id of the user
    author = db.StringField(required=True, max_length=50)
    meta = {'collection': 'comments'}
예제 #2
0
class Post(db.Document):
    subject = db.StringField()
    author = db.StringField(required=True, max_length=50)
    description = db.StringField()
    created_at = db.DateTimeField(required=True, default=datetime.utcnow)
    comments = db.ListField(db.ReferenceField('Comment'))
    # Post will have a list of comments
    meta = {'collection': 'posts'}
예제 #3
0
class Document(db.Document):
    # name of the file
    filename = db.StringField()
    # which assignment this document belongs to
    assignment = db.ReferenceField('Assignment')
    # who is submitted the document
    submitted_by = db.ReferenceField('User')
    # when submitted the document
    submitted_date = db.DateTimeField(required=True, default=datetime.utcnow)
    meta = {'collection': 'documents'}
예제 #4
0
class Assignment(db.Document):
    title = db.StringField(required=True, max_length=200)
    description = db.StringField()
    # who is created this assignment. that means the reference of the user
    created_by = db.ReferenceField('User')
    # which school belongs to this assignment.
    school = db.ReferenceField('School')
    # Assignment will have a submission date
    submission_date = db.DateTimeField(required=True)
    # Assignment will have a status open or close. true means open false means close
    status = db.BooleanField(required=True, default=True)
    # An assignment will have a list of document which we can call documents
    documents = db.ListField(db.ReferenceField('Document'))
    meta = {'collection': 'assignments'}
예제 #5
0
class Chat(db.Document):
    description = db.StringField(required=True)
    # A user reference who is added this chat
    user = db.ReferenceField('User')
    created_at = db.DateTimeField(required=True, default=datetime.utcnow)
    meta = {'collection': 'chats'}
예제 #6
0
class File(db.Document):
    user = db.ReferenceField('User')
    filename = db.StringField()
    tags = db.ListField(db.StringField(), default=list)
    created_at = db.DateTimeField(required=True, default=datetime.utcnow)
    meta = {'collection': 'files'}