File size: 605 Bytes
b7a7f32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from core.db import Base
from sqlalchemy import Column, Integer, ForeignKey, SmallInteger
from sqlalchemy.orm import relationship
from .association_tables import (
    group_course_association_table,
    group_quiz_association_table,
)


class Group(Base):
    id = Column(Integer, primary_key=True)
    program_id = Column(Integer, ForeignKey("program.id", ondelete="cascade"))
    program = relationship("Program", backref="groups")
    sem = Column(SmallInteger)
    course = relationship(
        "Course", secondary=group_course_association_table, backref="groups"
    )

    __tablename__ = "group"