"""The Badge model.""" from sqlalchemy import ( Column, Integer, Text, LargeBinary, ) from sqlalchemy.orm import relationship from .meta import Base class Badge(Base): """Represents a badge. Badges have a title and an image and can be defined by the admin. :ivar id: Database ID. :vartype id: int :ivar title: Title of the badge. :vartype title: str :ivar image: Image of the badge. :vartype image: bytes :ivar tracks: Tracks associated with this badge. :vartype tracks: list[fietsboek.models.track.Track] """ # pylint: disable=too-few-public-methods __tablename__ = 'badges' id = Column(Integer, primary_key=True) title = Column(Text) image = Column(LargeBinary) tracks = relationship('Track', secondary='track_badge_assoc', back_populates='badges')