You've already forked hotpocket
BTHLABS-94: Pass is_netloc_banned from save to share extension
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import datetime
|
||||
import typing
|
||||
import uuid
|
||||
|
||||
import pydantic
|
||||
@@ -50,6 +51,18 @@ class AssociationOut(ModelOut):
|
||||
class AssociationWithTargetOut(AssociationOut):
|
||||
target: SaveOut
|
||||
|
||||
@classmethod
|
||||
def from_association_save(cls: typing.Type[typing.Self],
|
||||
association: AssociationOut,
|
||||
save: SaveOut,
|
||||
) -> typing.Self:
|
||||
return cls.model_validate(
|
||||
obj={
|
||||
**association.model_dump(by_alias=True),
|
||||
'target': save,
|
||||
},
|
||||
)
|
||||
|
||||
@property
|
||||
def title(self) -> str | None:
|
||||
return self.get_title() or self.target.title
|
||||
|
||||
Reference in New Issue
Block a user