Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
585 B
3
Indexable
Never
class DepartmentTarget(ormar.Model):
    class Meta(BaseMetaCustomerTarget):
        tablename: str = "departments"

    id: int = ormar.Integer(primary_key=True)
    department_name: str = ormar.String(max_length=100)
  
class CourseTarget(ormar.Model):
    class Meta(BaseMetaCustomerTarget):
        tablename: str = "courses"

    id: int = ormar.Integer(primary_key=True)
    course_name: str = ormar.String(max_length=100)
    completed: bool = ormar.Boolean()
    department: Optional[DepartmentTarget] = ormar.ForeignKey(DepartmentTarget,related_name="courses")