From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id CF3F61395E3 for ; Wed, 7 Dec 2016 01:58:35 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 54FDDE0CB8; Wed, 7 Dec 2016 01:58:34 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 2C5DDE0CB8 for ; Wed, 7 Dec 2016 01:58:34 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D4771341026 for ; Wed, 7 Dec 2016 01:58:32 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 3E94E4A6 for ; Wed, 7 Dec 2016 01:58:31 +0000 (UTC) From: "Mart Raudsepp" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mart Raudsepp" Message-ID: <1481075718.ed46487bc107c4f404d23e6429e0e4050616459b.leio@gentoo> Subject: [gentoo-commits] proj/grumpy:master commit in: backend/lib/ X-VCS-Repository: proj/grumpy X-VCS-Files: backend/lib/models.py X-VCS-Directories: backend/lib/ X-VCS-Committer: leio X-VCS-Committer-Name: Mart Raudsepp X-VCS-Revision: ed46487bc107c4f404d23e6429e0e4050616459b X-VCS-Branch: master Date: Wed, 7 Dec 2016 01:58:31 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: db29acb4-a86b-41c8-a5de-6217cd6f7a6e X-Archives-Hash: 866b1f2f61524cde5ba50ca9738afebe commit: ed46487bc107c4f404d23e6429e0e4050616459b Author: Mart Raudsepp gentoo org> AuthorDate: Wed Dec 7 01:55:18 2016 +0000 Commit: Mart Raudsepp gentoo org> CommitDate: Wed Dec 7 01:55:18 2016 +0000 URL: https://gitweb.gentoo.org/proj/grumpy.git/commit/?id=ed46487b models: Add package maintainers relationship table and ORM relationships backend/lib/models.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/backend/lib/models.py b/backend/lib/models.py index e06dcf8..ba20622 100644 --- a/backend/lib/models.py +++ b/backend/lib/models.py @@ -10,6 +10,11 @@ class Category(db.Model): def __repr__(self): return "" % self.name +package_maintainer_rel_table = db.Table('package_maintainer_rel', + db.Column('package_id', db.Integer, db.ForeignKey('package.id')), + db.Column('maintainer_id', db.Integer, db.ForeignKey('maintainer.id')), +) + class Package(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.Unicode(128), nullable=False) @@ -17,6 +22,9 @@ class Package(db.Model): category = db.relationship('Category', backref=db.backref('packages', lazy='dynamic')) description = db.Column(db.Unicode(500)) last_sync_ts = db.Column(db.TIMESTAMP, nullable=False, default=datetime.utcfromtimestamp(0)) + maintainers = db.relationship("Maintainer", + secondary=package_maintainer_rel_table, + backref='directly_maintained_packages') @property def full_name(self): @@ -54,6 +62,7 @@ class Maintainer(db.Model): secondaryjoin=id==maintainer_project_membership_rel_table.c.maintainer_id, backref='projects') # projects relationship backref ^^ + # directly_maintained_packages backref - list of packages maintained directly by given project or individual maintainer (as opposed to a bigger list that includes packages maintained by parent/child projects or projects the given individual maintainer is part of) def __repr__(self): return "" % ("project" if self.is_project else "individual", self.email)