From 18d9c93fff15724bb33651c46ab7a7b828545ff4 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Fri, 14 Dec 2012 15:03:15 +0100 Subject: [PATCH] add default itemKey value support, add license as default value to pad.ma. fixes #1180 --- pandora/config.padma.jsonc | 6 +++++- pandora/item/models.py | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pandora/config.padma.jsonc b/pandora/config.padma.jsonc index a7365e34..f5fc1812 100644 --- a/pandora/config.padma.jsonc +++ b/pandora/config.padma.jsonc @@ -454,7 +454,11 @@ "type": ["string"], "columnWidth": 120, "filter": true, - "sort": true + "sort": true, + "default": [ + "Creative Commons Attribution-ShareAlike 3.0 License", + "Pad.ma General Public License" + ] }, { "id": "rightslevel", diff --git a/pandora/item/models.py b/pandora/item/models.py index 59a89c68..ec274114 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -112,6 +112,10 @@ def get_item(info, user=None, async=False): item = Item() item.user = user item.data = item_data + #set default values + for k in settings.CONFIG['itemKeys']: + if 'default' in k: + item.data[k['id']] = default_data[k['default']] item.itemId = info.get('oxdbId', item.oxdb_id()) try: existing_item = Item.objects.get(oxdbId=item.oxdb_id())