class Class(db.Model):
id = db.Column(db.Integer, primary_key=True)
students = db.relationship('Students', backref='class')
def as_dict(self):
result = {col.name: getattr(self, col.name) for col in self.__table__.columns}
# add students data to result dict
result['students'] = [student.