示例#1
0
class Module3(db.Document):
    # Each document in this collection refers to a different school and contains information about module3 for that school.
    files = db.ListField(db.ReferenceField('File'))
    # The list of files in module3 for that school
    chats = db.ListField(db.ReferenceField('Chat'))
    # The list of posts in module3 for that school
    meta = {'collection': 'module3'}
示例#2
0
class Module1(db.Document):
    # Each document in this collection refers to a different school and contains information about module1 for that school.
    files = db.ListField(db.ReferenceField('File'))
    # The list of files in module1 for that school
    chats = db.ListField(db.ReferenceField('Chat'))
    #'chats' refers to the posts made by a teacher on the 'module post board', was called 'module chat' but i have not since changed the naming convention to match the new feature name
    meta = {'collection': 'module1'}
示例#3
0
class Module2(db.Document):
    # Each document in this collection refers to a different school and contains information about module2 for that school.
    files = db.ListField(db.ReferenceField('File'))
    # The list of files in module2 for that school
    chats = db.ListField(db.ReferenceField('Chat'))
    # List of posts for module post board made by a teacher
    meta = {'collection': 'module2'}
示例#4
0
class Document(db.Document):
    # Name of the file
    filename = db.StringField()
    # Which assignment this document belongs to, document being the students submissopm
    assignment = db.ReferenceField('Assignment')
    # Who is submitted the document
    submitted_by = db.ReferenceField('User')
    # When was the document submitted
    submitted_date = db.DateTimeField(required=True, default=datetime.utcnow)
    meta = {'collection': 'documents'}
示例#5
0
class Comment(db.DynamicDocument):
    # For replies to questions in teacher discussion forum
    description = db.StringField()
    post = db.ReferenceField('Post')
    # Refernece to what post(question) the comment (reply) is for
    created_at = db.DateTimeField(required=True, default=datetime.utcnow)
    user_id = db.ReferenceField(User)
    # Store id of the user
    author = db.StringField(required=True, max_length=50)
    meta = {'collection': 'comments'}
示例#6
0
class School(db.Document):
    # There is a school document created for each indivdual school, it holds information about the school
    # School name, assignments, and posts and files added to each module
    # The info related to what each module contains for each school is not actually held in school document but is held in collections Module1,Module2,Module3 and then referencing those here.
    name = db.StringField(required=True, max_length=100)
    module1 = db.ReferenceField('Module1')
    # In create() for teachers on line 39 school.module1 = module1.id
    # ReferenceField allows us to reference to another document
    module2 = db.ReferenceField('Module2')
    module3 = db.ReferenceField('Module3')
    # A school will have a list of assignments
    assignments = db.ListField(db.ReferenceField('Assignment'))
    meta = {'collection': 'schools'}
示例#7
0
class Assignment(db.Document):
    title = db.StringField(required=True, max_length=200)
    description = db.StringField()
    # Who created the assignment.
    created_by = db.ReferenceField('User')
    # What school.
    school = db.ReferenceField('School')
    # Submission date
    submission_date = db.DateTimeField(required=True)
    # Status open or close. true means open false means close
    status = db.BooleanField(required=True, default=True)
    # Submitted documents
    documents = db.ListField(db.ReferenceField('Document'))
    meta = {'collection': 'assignments'}
示例#8
0
class Post(db.Document):
    # For teacher discussion forum, post refers to a question
    # Details for each question asked
    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, comments being replies
    meta = {'collection': 'posts'}
示例#9
0
class File(db.Document):
    # Each document in this collection refers to a different file
    # Files are NOT stored in database, Files are stored on the machine that is hosting the website
    # Files are stored in the 'Uploads Folder'
    # http://flask.pocoo.org/docs/1.0/patterns/fileuploads/
    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'}
示例#10
0
class Chat(
        db.Document
):  #Note: Chat refers to "Module Post Board", It was first called "Module Chat" but changed the name
    # All posts made by module post board are stored in the Chat collection for every school and module.
    # the document id of the post just made is saved to module1/2/3.chats and that is what is used to fetch the correct posts for each school's module
    description = db.StringField(required=True)
    #description is the post itself
    user = db.ReferenceField('User')
    # A user reference to who added this post
    created_at = db.DateTimeField(required=True, default=datetime.utcnow)
    #time the post was made at for display purposes
    meta = {'collection': 'chats'}
示例#11
0
class User(db.DynamicDocument):
    dl_docs_array = db.ListField(db.ReferenceField('File'))
    # This List was to keep track of all the files a user download, feature was not finished
    login_counter = db.IntField()
    # Counter for the amount of times the user has logged in,  feature was not finished
    login_array = db.ListField(db.DateField())
    # List of the last 5 times a user logged in,  feature was not finished, this and two about meant for student progress
    title = db.StringField()
    # Title of user, Mr, Dr etc
    approved = db.BooleanField()
    # Boolean used to check if student is approved to class or not
    name = db.StringField(required=True, max_length=50)
    surname = db.StringField(required=True)
    email = db.EmailField(required=True)
    password = db.BinaryField(required=True)
    user_type = db.StringField(required=True)
    school = db.ReferenceField(School)
    # Here we will store what school the user is in
    posts = db.ListField(db.ReferenceField('Post'))
    # List of all the questions user has added to teacher discussion forum

    meta = {'collection': 'users'}