From 7cd60b2f9706bae24afe732586038cc1c2681e30 Mon Sep 17 00:00:00 2001 From: Omer Lachish Date: Tue, 16 Apr 2019 16:12:32 +0300 Subject: [PATCH] add get_by_id to Organization --- redash/models/organizations.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/redash/models/organizations.py b/redash/models/organizations.py index fcf8cc8c2f..28df95b918 100644 --- a/redash/models/organizations.py +++ b/redash/models/organizations.py @@ -32,6 +32,10 @@ def __str__(self): def get_by_slug(cls, slug): return cls.query.filter(cls.slug == slug).first() + @classmethod + def get_by_id(cls, _id): + return cls.query.filter(cls.id == _id).one() + @property def default_group(self): return self.groups.filter(Group.name == 'default', Group.type == Group.BUILTIN_GROUP).first()