Пример #1
0
    def setUp(self):
        db.drop_all()
        db.create_all()

        teacher = Teacher.seed_db(name="teacher_name", username="******", password="******")
        db.session.add(teacher)

        student = Student.seed_db(name="student_name", username="******", password="******", teacher_id=1)
        db.session.add(student)

        assignment = Assignment(title='title', body='body', teacher_id=1)
        db.session.add(assignment)

        one = StudentAssignment(assignment_id=assignment.id, student_id=student.id)
        db.session.add(one)

        db.session.commit()
Пример #2
0
from app import app
from models import db, Teacher, Student, Assignment, StudentAssignment
import requests

db.drop_all()
db.create_all()

scott = Teacher.seed_db(name="burden", username="******", password="******")

db.session.add(scott)
db.session.commit()

s = Teacher.query.get(1)

s0 = Student.seed_db(name="John A",
                     username="******",
                     password="******",
                     teacher_id=1)
s1 = Student.seed_db(name="John B",
                     username="******",
                     password="******",
                     teacher_id=1)
s2 = Student.seed_db(name="John C",
                     username="******",
                     password="******",
                     teacher_id=1)
s3 = Student.seed_db(name="John D",
                     username="******",
                     password="******",
                     teacher_id=1)
s4 = Student.seed_db(name="John E",