Module userland.models.message
Message model
Sub-modules
userland.models.message.api
-
Shared userland messages API
userland.models.message.message_tags
-
Message tag relationship model
userland.models.message.tag
-
Message tag model
Classes
class Message (**values)
-
Message model
Expand source code
class Message(db.Model): """Message model""" id = Column(Integer(), primary_key=True) """Unique ID""" parent_id = Column( None, ForeignKey("message.id", onupdate="cascade", ondelete="set null"), nullable=True, ) """Parent message (if any)""" parent: "Message | None" author_id = Column( None, ForeignKey(User.id, onupdate="cascade", ondelete="set null"), nullable=True, ) """Author of the message""" author: User recipient_id = Column( None, ForeignKey(User.id, onupdate="cascade", ondelete="cascade"), nullable=True, ) """Recipient of the message (`None` for public messages)""" recipient: User | None created = Column(DateTime(), default=datetime.utcnow, nullable=False) """Creation time""" title = Column(String(120), nullable=False) """Title of the message""" content = Column(Text(), nullable=False) """The message's content""" __tablename__ = "message" def __repr__(self): return f"Message(#{self.id})"
Ancestors
- gino.declarative.Model
- gino.crud.CRUDModel
- gino.declarative.Model
Class variables
-
Author of the message
var content
-
The message's content
var created
-
Creation time
var id
-
Unique ID
var parent : Message | None
var parent_id
-
Parent message (if any)
var recipient : User | None
var recipient_id
-
Recipient of the message (
None
for public messages) var title
-
Title of the message