fix: default option in attributes
This commit is contained in:
@ -8,7 +8,7 @@ from models.base import BaseModel
|
||||
from models.mixins import IdMixin, SoftDeleteMixin
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from models import Module, Deal, AttributeSelect
|
||||
from models import Module, Deal, AttributeSelect, AttributeOption
|
||||
|
||||
module_attribute = Table(
|
||||
"module_attribute",
|
||||
@ -39,7 +39,15 @@ class Attribute(BaseModel, IdMixin, SoftDeleteMixin):
|
||||
comment="Применять ли изменения атрибута карточки ко всем карточкам в группе",
|
||||
)
|
||||
is_nullable: Mapped[bool] = mapped_column(default=False)
|
||||
|
||||
default_value: Mapped[Optional[dict[str, any]]] = mapped_column(JSONB)
|
||||
default_option_id: Mapped[Optional[int]] = mapped_column(
|
||||
ForeignKey("attribute_options.id")
|
||||
)
|
||||
default_option: Mapped[Optional["AttributeOption"]] = relationship(
|
||||
backref="attributes", lazy="joined"
|
||||
)
|
||||
|
||||
description: Mapped[str] = mapped_column(default="")
|
||||
|
||||
is_built_in: Mapped[bool] = mapped_column(default=False)
|
||||
|
||||
Reference in New Issue
Block a user