add default itemKey value support, add license as default value to pad.ma. fixes #1180

This commit is contained in:
j 2012-12-14 15:03:15 +01:00
parent 80e9569595
commit 18d9c93fff
2 changed files with 9 additions and 1 deletions

View file

@ -454,7 +454,11 @@
"type": ["string"], "type": ["string"],
"columnWidth": 120, "columnWidth": 120,
"filter": true, "filter": true,
"sort": true "sort": true,
"default": [
"Creative Commons Attribution-ShareAlike 3.0 License",
"Pad.ma General Public License"
]
}, },
{ {
"id": "rightslevel", "id": "rightslevel",

View file

@ -112,6 +112,10 @@ def get_item(info, user=None, async=False):
item = Item() item = Item()
item.user = user item.user = user
item.data = item_data 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()) item.itemId = info.get('oxdbId', item.oxdb_id())
try: try:
existing_item = Item.objects.get(oxdbId=item.oxdb_id()) existing_item = Item.objects.get(oxdbId=item.oxdb_id())