Module userland.models
Default userland models
Sub-modules
userland.models.message
-
Message model
userland.models.oneliner
-
Oneliner 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
class MessageTag (**values)
-
Message tag model
Expand source code
class MessageTag(db.Model): """Message tag model""" name = Column(String(32), primary_key=True) """The tag's name""" created = Column(DateTime(), default=datetime.utcnow, nullable=False) """When the tag was created""" __tablename__ = "message_tag" def __repr__(self): return f"MessageTag({self.name})"
Ancestors
- gino.declarative.Model
- gino.crud.CRUDModel
- gino.declarative.Model
Class variables
var created
-
When the tag was created
var name
-
The tag's name
class MessageTags (**values)
-
Message tag model
Expand source code
class MessageTags(db.Model): """Message tag model""" message_id = Column( None, ForeignKey("message.id", onupdate="cascade", ondelete="cascade"), nullable=False, ) """The tagged message ID""" tag_name = Column( None, ForeignKey("message_tag.name", onupdate="cascade", ondelete="cascade"), nullable=False, ) """The name of the tag""" __tablename__ = "message_x_message_tag"
Ancestors
- gino.declarative.Model
- gino.crud.CRUDModel
- gino.declarative.Model
Class variables
var message_id
-
The tagged message ID
var tag_name
-
The name of the tag
class Oneliner (**values)
-
Oneliner model
Expand source code
class Oneliner(db.Model): """Oneliner model""" MAX_LENGTH = 120 """Maximum length of oneliner messages""" id = Column(Integer(), primary_key=True) """Unique ID""" user_id = Column( Integer(), ForeignKey(User.id, onupdate="cascade", ondelete="set null"), nullable=True, ) """User who left the oneliner""" message = Column(Unicode(MAX_LENGTH)) """The oneliner message""" timestamp = Column(DateTime(), default=datetime.utcnow) """When the oneliner was posted""" __tablename__ = "oneliner" def __repr__(self): return f"Oneliner(#{self.id})"
Ancestors
- gino.declarative.Model
- gino.crud.CRUDModel
- gino.declarative.Model
Class variables
var MAX_LENGTH
-
Maximum length of oneliner messages
var id
-
Unique ID
var message
-
The oneliner message
var timestamp
-
When the oneliner was posted
var user_id
-
User who left the oneliner