aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Dartiguelongue <eva@gentoo.org>2017-01-22 12:58:33 +0100
committerGilles Dartiguelongue <eva@gentoo.org>2017-01-22 13:00:24 +0100
commit24047d7602bbdbaae60f88e6811dc8570227161f (patch)
treedd098a82b6f331b380583dcc822220a218877572
parentsync: use assert for GLEP67 compliance check (diff)
downloadgrumpy-24047d7602bbdbaae60f88e6811dc8570227161f.tar.gz
grumpy-24047d7602bbdbaae60f88e6811dc8570227161f.tar.bz2
grumpy-24047d7602bbdbaae60f88e6811dc8570227161f.zip
sync: use ORM magics in sync_packages
ORM knows howto map objects to ids through relationships so skip the details and focus on the thing you want to do.
-rw-r--r--backend/lib/sync.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/backend/lib/sync.py b/backend/lib/sync.py
index ba31477..dbb44c2 100644
--- a/backend/lib/sync.py
+++ b/backend/lib/sync.py
@@ -144,7 +144,7 @@ def sync_packages():
if package['name'] in existing_packages:
continue # TODO: Update description once we keep that in DB
else:
- new_pkg = Package(category_id=category.id, name=package['name'])
+ new_pkg = Package(category=category, name=package['name'])
db.session.add(new_pkg)
db.session.commit()