Skip to content

Instantly share code, notes, and snippets.

@zgoda zgoda/

Created May 31, 2017
What would you like to do?
Hybrid property
class Platform(db.Model, ModelMixin):
__tablename__ = 'platform'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(200), nullable=False, index=True)
homepage = db.Column(db.String(200))
description = db.Column(db.Text)
def versions_ordered(self):
return self.versions.order_by(db.desc(PlatformVersion.release_date))
def version_count(self):
return self.versions.count()
def latest_version(self):
return self.versions.order_by(db.desc(PlatformVersion.version_str)).first()
def report_count(self):
return sum([x.reports.count() for x in self.versions])
def report_count(cls):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.