back population
This commit is contained in:
parent
c4ad9a8e40
commit
ac6e506486
1 changed files with 10 additions and 2 deletions
|
@ -24,10 +24,10 @@ class User(ORMBaseModel):
|
||||||
"UserCapability", lazy="joined", cascade="all, delete-orphan"
|
"UserCapability", lazy="joined", cascade="all, delete-orphan"
|
||||||
)
|
)
|
||||||
certificates: list[Certificate] = relationship(
|
certificates: list[Certificate] = relationship(
|
||||||
"Certificate", lazy="select"
|
"Certificate", lazy="select", back_populates="owner"
|
||||||
)
|
)
|
||||||
distinguished_names: list[DistinguishedName] = relationship(
|
distinguished_names: list[DistinguishedName] = relationship(
|
||||||
"DistinguishedName", lazy="select"
|
"DistinguishedName", lazy="select", back_populates="owner"
|
||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -69,6 +69,10 @@ class DistinguishedName(ORMBaseModel):
|
||||||
email = Column(String)
|
email = Column(String)
|
||||||
common_name = Column(String, nullable=False)
|
common_name = Column(String, nullable=False)
|
||||||
|
|
||||||
|
owner: User = relationship(
|
||||||
|
"User", lazy="joined", back_populates="distinguished_names"
|
||||||
|
)
|
||||||
|
|
||||||
UniqueConstraint(
|
UniqueConstraint(
|
||||||
country,
|
country,
|
||||||
state,
|
state,
|
||||||
|
@ -96,3 +100,7 @@ class Certificate(ORMBaseModel):
|
||||||
distinguished_name: DistinguishedName = relationship(
|
distinguished_name: DistinguishedName = relationship(
|
||||||
"DistinguishedName", lazy="joined"
|
"DistinguishedName", lazy="joined"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
owner: User = relationship(
|
||||||
|
"User", lazy="joined", back_populates="certificates"
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in a new issue