From ce62938d24c34e956f1a1cb33737d04b8ea8a902 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aitor=20Mag=C3=A1n=20Garc=C3=ADa?= Date: Fri, 17 Mar 2017 19:11:15 +0100 Subject: [PATCH] Fix #15 --- ckanext/datarequests/db.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ckanext/datarequests/db.py b/ckanext/datarequests/db.py index 11f319d7..b8f51328 100644 --- a/ckanext/datarequests/db.py +++ b/ckanext/datarequests/db.py @@ -17,6 +17,8 @@ # You should have received a copy of the GNU Affero General Public License # along with CKAN Data Requests Extension. If not, see . +import ckan.model as model + import constants import sqlalchemy as sa import uuid @@ -32,6 +34,8 @@ def uuid4(): return str(uuid.uuid4()) +# TODO: Remove this init_db function and let the classes to be initialized once the script is imported +# Note: Tests have to be changed and calls to init_db from the actions module have to be deleted def init_db(model): global DataRequest @@ -141,3 +145,5 @@ def get_datarequest_comments_number(cls, **kw): comments_table.create(checkfirst=True) model.meta.mapper(Comment, comments_table,) + +init_db(model)