Skip to content

cattle_grid.extensions.examples.context

Extension to add information to the context

See FEP-f228

This extension requires the muck out extension to be installed.

models

Base

Bases: AsyncAttrs, DeclarativeBase

Base model

Source code in cattle_grid/extensions/examples/context/models.py
class Base(AsyncAttrs, DeclarativeBase):
    """Base model"""

    pass

ContextInformation

Bases: Base

Contains information about the context

Source code in cattle_grid/extensions/examples/context/models.py
class ContextInformation(Base):
    """Contains information about the context"""

    __tablename__ = "context_information"

    id: Mapped[int] = mapped_column(primary_key=True)

    context_id: Mapped[bytes] = mapped_column(UUIDType(binary=True))
    """The id (uuid as bytes)"""

    object_id: Mapped[str] = mapped_column(String(256))
    """The object in this context"""

    parent_id: Mapped[str | None] = mapped_column(String(256), default=None)
    """id of the post, that was replied to"""

context_id class-attribute instance-attribute

context_id: Mapped[bytes] = mapped_column(
    UUIDType(binary=True)
)

The id (uuid as bytes)

object_id class-attribute instance-attribute

object_id: Mapped[str] = mapped_column(String(256))

The object in this context

parent_id class-attribute instance-attribute

parent_id: Mapped[str | None] = mapped_column(
    String(256), default=None
)

id of the post, that was replied to