Module userland.models.oneliner

Oneliner model

Classes

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