blob: 37fa1402b2dff9c3ef7412611cfe29fc38d3c4d3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
"""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')
|