class Timeslot(db.Model): id = db.Column(db.Integer, primary_key=True) day = db.Column(db.String(32)) start = db.Column(db.String(32)) end = db.Column(db.String(32)) votable = db.Column(db.Boolean) event = db.Column(db.String(128)) def get_number_votes(self, gameid): return len( GameVote.query.filter_by(slot_id=self.id, game_id=gameid).all())
class TrackRequest(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(128)) artist = db.Column(db.String(128)) url = db.Column(db.String(128)) user_id = db.Column(db.Integer) played = db.Column(db.Boolean) votes = db.Column(db.Integer) def get_requester(self): return users.get_user(user_id=self.user_id)
class DownloadFile(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(64)) description = db.Column(db.Text) url = db.Column(db.String(128)) tags = db.relationship("DownloadTag", secondary=downloads_tagged, backref=db.backref('files', lazy="dynamic")) def get_tags(self): return [tag.name for tag in self.tags]
class DownloadTag(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(64), unique=True)
class Game(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(64)) primary = db.Column(db.Boolean)