1
0
Fork 0
mirror of https://github.com/Findus23/RadioStats.git synced 2024-09-19 16:03:48 +02:00
RadioStats/models.py

31 lines
716 B
Python
Raw Normal View History

2018-02-05 21:44:37 +01:00
from peewee import *
from basemodel import BaseModel
class Channel(BaseModel):
shortname = CharField(unique=True, max_length=5)
2018-02-08 15:40:00 +01:00
streamurl = CharField(null=True)
2018-02-05 21:44:37 +01:00
stationname = CharField()
2018-02-08 15:40:00 +01:00
has_data = BooleanField()
primary_color = CharField(max_length=7)
secondary_color = CharField(max_length=7,null=True)
2018-02-05 21:44:37 +01:00
class Song(BaseModel):
artist = CharField(max_length=150)
title = CharField(max_length=150)
show = BooleanField()
class Meta:
indexes = ((("artist", "title"), True),)
class Play(BaseModel):
song = ForeignKeyField(Song)
channel = ForeignKeyField(Channel)
time = DateTimeField()
class Meta:
indexes = ((("time", "channel"), True),)