From f280f2ba8220de98695a878b5497f065d42d07ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Renaud=20Micha=C3=ABlis?= Date: Fri, 19 Jul 2019 15:39:03 +0200 Subject: [PATCH] Public categories defined in DB --- geoportal/geoportailv3_geoportal/mymaps.py | 1 + geoportal/geoportailv3_geoportal/views/mymaps.py | 7 +------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/geoportal/geoportailv3_geoportal/mymaps.py b/geoportal/geoportailv3_geoportal/mymaps.py index c1a955981..a9eb6c366 100644 --- a/geoportal/geoportailv3_geoportal/mymaps.py +++ b/geoportal/geoportailv3_geoportal/mymaps.py @@ -280,6 +280,7 @@ class Category(Base): id = Column(Integer, primary_key=True) name = Column(Unicode(255)) allow_labeling = Column(Boolean) + list = Column(Boolean) def __init__(self, name): self.name = name diff --git a/geoportal/geoportailv3_geoportal/views/mymaps.py b/geoportal/geoportailv3_geoportal/views/mymaps.py index 733f4306b..afe47b04e 100644 --- a/geoportal/geoportailv3_geoportal/views/mymaps.py +++ b/geoportal/geoportailv3_geoportal/views/mymaps.py @@ -335,12 +335,7 @@ def public_categories(self): db_mymaps = self.db_mymaps categories = self.db_mymaps.query(Category) categories = categories.filter(Category.id != 999).\ - filter(Category.id.in_( - db_mymaps.query(RoleCategories.category_id).filter( - ~or_(and_(RoleCategories.category_id >= 70, - RoleCategories.category_id <= 80), - and_(RoleCategories.category_id >= 200, - RoleCategories.category_id <= 302))).all())) + filter(Category.list == True) # noqa categories = categories.order_by("name asc") categ = [] for category in categories.all():