Example #1
0
class EnrollmentSchema(ma.Schema):
    class Meta:
        fields = ('id', 'enroll_date', 'student_id', 'course_id', 'student',
                  'course')

    student = ma.Nested(UserSchema)
    course = ma.Nested(CourseSchema)
Example #2
0
class CourseExtraSchema(ma.Schema):
    class Meta:
        fields = ('id', 'name', 'created_at',
                  'close_date', 'teacher_id', 'teacher', 'students', 'sections')
    teacher = ma.Nested(UserProfileSchema)
    students = ma.Nested(EnrollmentStudentSchema, many=True)
    sections = ma.Nested(SectionSchema, many=True)
Example #3
0
class SectionSchema(ma.Schema):
    class Meta:
        fields = ('id', 'count', 'date', 'course_id', 'photo', 'photo_result',
                  'course', 'attendances', 'links')

    course = ma.Nested(CourseSchema)
    attendances = ma.Nested(AttendancesSchema, many=True)
    links = ma.Hyperlinks({
        "class_photo":
        ma.URLFor("section.photo", name="<photo>"),
        "class_photo_result":
        ma.URLFor("section.photo", name="<photo_result>"),
    })
Example #4
0
class AttendancesSchema(ma.Schema):
    class Meta:
        fields = ('id', 'student', 'status')

    student = ma.Nested(UserProfileSchema)
Example #5
0
class EnrollmentStudentSchema(ma.Schema):
    class Meta:
        fields = ('student', )

    student = ma.Nested(UserProfileSchema)
Example #6
0
class CourseSchema(ma.Schema):
    class Meta:
        fields = ('id', 'name', 'created_at',
                  'close_date', 'teacher_id', 'teacher')

    teacher = ma.Nested(UserProfileSchema)