forked from 0x2620/pandora
home links, inline content
This commit is contained in:
parent
ff19404e6d
commit
ee4d00eaaf
1 changed files with 15 additions and 2 deletions
|
@ -27,14 +27,15 @@ class Item(models.Model):
|
||||||
'contentid',
|
'contentid',
|
||||||
'crop',
|
'crop',
|
||||||
'image',
|
'image',
|
||||||
|
'link',
|
||||||
'text',
|
'text',
|
||||||
'title',
|
'title',
|
||||||
'type',
|
'type',
|
||||||
):
|
):
|
||||||
if key in data and self.data.get(key) != data[key]:
|
if key in data and self.data.get(key) != data[key]:
|
||||||
if key == 'crop':
|
if key == 'crop':
|
||||||
if not (isinstance(data[key], list)
|
if not (isinstance(data[key], list) and
|
||||||
and len([d for d in data[key] if isinstance(d, int)]) == 4):
|
len([d for d in data[key] if isinstance(d, int)]) == 4):
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
if not isinstance(data[key], string_types):
|
if not isinstance(data[key], string_types):
|
||||||
|
@ -67,6 +68,18 @@ class Item(models.Model):
|
||||||
'index': self.index,
|
'index': self.index,
|
||||||
}
|
}
|
||||||
j.update(self.data)
|
j.update(self.data)
|
||||||
|
if 'contentid' in j and (not keys or 'content' in keys):
|
||||||
|
content_keys = ['description', 'modified', 'name', 'user']
|
||||||
|
type = j.get('type')
|
||||||
|
if type == 'list':
|
||||||
|
from itemlist.models import List
|
||||||
|
j['content'] = List.get(j['contentid']).json(keys=content_keys)
|
||||||
|
elif type == 'edit':
|
||||||
|
from edit.models import Edit
|
||||||
|
j['content'] = Edit.get(j['contentid']).json(keys=content_keys)
|
||||||
|
elif type == 'collection':
|
||||||
|
from documentcollection.models import Collection
|
||||||
|
j['content'] = Collection.get(j['contentid']).json(keys=content_keys)
|
||||||
if keys:
|
if keys:
|
||||||
for key in list(j):
|
for key in list(j):
|
||||||
if key not in keys:
|
if key not in keys:
|
||||||
|
|
Loading…
Reference in a new issue