mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
add PackageGroup SQLAlchemy ORM model
Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
a8a9c28783
commit
4201348dea
2 changed files with 79 additions and 0 deletions
27
aurweb/models/package_group.py
Normal file
27
aurweb/models/package_group.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
from sqlalchemy.orm import mapper
|
||||
|
||||
from aurweb.db import make_relationship
|
||||
from aurweb.models.group import Group
|
||||
from aurweb.models.package import Package
|
||||
from aurweb.schema import PackageGroups
|
||||
|
||||
|
||||
class PackageGroup:
|
||||
def __init__(self, Package: Package = None, Group: Group = None):
|
||||
self.Package = Package
|
||||
self.Group = Group
|
||||
|
||||
|
||||
properties = {
|
||||
"Package": make_relationship(Package,
|
||||
PackageGroups.c.PackageID,
|
||||
"package_group",
|
||||
uselist=False),
|
||||
"Group": make_relationship(Group,
|
||||
PackageGroups.c.GroupID,
|
||||
"package_group",
|
||||
uselist=False)
|
||||
}
|
||||
|
||||
mapper(PackageGroup, PackageGroups, properties=properties,
|
||||
primary_key=[PackageGroups.c.PackageID, PackageGroups.c.GroupID])
|
Loading…
Add table
Add a link
Reference in a new issue