diff options
author | 2017-01-22 12:58:33 +0100 | |
---|---|---|
committer | 2017-01-22 13:00:24 +0100 | |
commit | 24047d7602bbdbaae60f88e6811dc8570227161f (patch) | |
tree | dd098a82b6f331b380583dcc822220a218877572 | |
parent | sync: use assert for GLEP67 compliance check (diff) | |
download | grumpy-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.py | 2 |
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() |