diff options
author | Priit Laes <plaes@plaes.org> | 2010-07-07 21:13:28 +0300 |
---|---|---|
committer | Priit Laes <plaes@plaes.org> | 2010-07-07 21:13:28 +0300 |
commit | 5184e4fbb1a19fa89e5861b35e62dcdd75e18ac5 (patch) | |
tree | 7178f07f23a1836b676f86e1f56c3e977be1786f | |
parent | Added *.egg-info to .gitignore (diff) | |
download | gsoc2010-grumpy-5184e4fbb1a19fa89e5861b35e62dcdd75e18ac5.tar.gz gsoc2010-grumpy-5184e4fbb1a19fa89e5861b35e62dcdd75e18ac5.tar.bz2 gsoc2010-grumpy-5184e4fbb1a19fa89e5861b35e62dcdd75e18ac5.zip |
Added PkgIssues class
-rw-r--r-- | grumpy/models.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/grumpy/models.py b/grumpy/models.py index 7916a23..7f0f13d 100644 --- a/grumpy/models.py +++ b/grumpy/models.py @@ -133,6 +133,8 @@ class Package(db.Model): ebuilds = db.relationship(Ebuild, backref='ebuilds', \ cascade='all, delete-orphan') + qaissues = db.relationship("PkgIssue", backref='qa_issues', \ + cascade='all, delete-orphan') devs = db.relationship(Developer, secondary=package_developers, \ backref='packages') herds = db.relationship(Herd, secondary=package_herds, backref='packages') @@ -160,3 +162,25 @@ class Package(db.Model): self.cp = cp for ebuild in self.ebuilds: ebuild.cpv = "%s-%s" % (cp, ebuild.version) + +class PkgIssue(db.Model): + """Package-related issues""" + + __tablename__ = 'pkg_issues' + + id = db.Column('id', db.Integer, primary_key=True) + plugin = db.Column('plugin', db.String) + type = db.Column('type', db.String) + data = db.Column('data', db.String) + _package = db.Column('package_id', db.Integer, db.ForeignKey('packages.id')) + + package = db.relationship(Package) + + def __init__(self, package, plugin, type, data): + self.package = package + self.plugin = plugin + self.data = data + self.type = type + + def __repr__(self): + return '<%s> - %s : %s' % (self.__class__.__name__, self.plugin, self.type) |