Coverage for docs_src/tutorial/code_structure/tutorial002/team_model.py: 100%
7 statements
« prev ^ index » next coverage.py v7.6.1, created at 2024-09-09 00:02 +0000
« prev ^ index » next coverage.py v7.6.1, created at 2024-09-09 00:02 +0000
1from typing import TYPE_CHECKING, List, Optional 1abcdef
3from sqlmodel import Field, Relationship, SQLModel 1abcdef
5if TYPE_CHECKING: 1abcdef
6 from .hero_model import Hero
9class Team(SQLModel, table=True): 1abcdef
10 id: Optional[int] = Field(default=None, primary_key=True) 1abcdef
11 name: str = Field(index=True) 1abcdef
12 headquarters: str 1abcdef
14 heroes: List["Hero"] = Relationship(back_populates="team") 1abcdef