From ff37eeb32a76a4d7d5b698acd49750f53ea5f014 Mon Sep 17 00:00:00 2001 From: Francesco Siddi Date: Fri, 20 Nov 2015 12:16:27 +0100 Subject: [PATCH] Introducing sorting for assets and groups By adding the order property, it is now possible to query assets and groups sorted by arbitrary order. --- pillar/manage/node_types/asset.py | 7 ++++++- pillar/manage/node_types/group.py | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/pillar/manage/node_types/asset.py b/pillar/manage/node_types/asset.py index d27fe53c..473e5fa0 100644 --- a/pillar/manage/node_types/asset.py +++ b/pillar/manage/node_types/asset.py @@ -18,9 +18,13 @@ node_type_asset = { 'deleted' ], }, + # Used for sorting within the context of a group + 'order': { + 'type': 'integer' + }, # We expose the type of asset we point to. Usually image, video, # zipfile, ect. - 'content_type':{ + 'content_type': { 'type': 'string' }, # We point to the original file (and use it to extract any relevant @@ -52,6 +56,7 @@ node_type_asset = { 'content_type': {'visible': False}, 'file': {'visible': False}, 'attachments': {'visible': False}, + 'order': {} }, 'permissions': { # 'groups': [{ diff --git a/pillar/manage/node_types/group.py b/pillar/manage/node_types/group.py index 5810bd20..e5d1169c 100644 --- a/pillar/manage/node_types/group.py +++ b/pillar/manage/node_types/group.py @@ -5,6 +5,10 @@ node_type_group = { 'node_types': ['group', 'project'] }, 'dyn_schema': { + # Used for sorting within the context of a group + 'order': { + 'type': 'integer' + }, 'url': { 'type': 'string', }, @@ -25,6 +29,7 @@ node_type_group = { 'url': {}, 'status': {}, 'notes': {}, + 'order': {} }, 'permissions': { # 'groups': [{