Added File NodeType
This commit is contained in:
@@ -199,6 +199,52 @@ def populate_node_types(old_ids={}):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
file_node_type= {
|
||||||
|
'name': 'file',
|
||||||
|
'description': 'File node type',
|
||||||
|
'dyn_schema': {
|
||||||
|
'contentType': {
|
||||||
|
'type': 'string',
|
||||||
|
},
|
||||||
|
'length': {
|
||||||
|
'type': 'integer',
|
||||||
|
},
|
||||||
|
'uploadDate': {
|
||||||
|
'type': 'datetime',
|
||||||
|
},
|
||||||
|
'md5': {
|
||||||
|
'type': 'string',
|
||||||
|
},
|
||||||
|
'filename': {
|
||||||
|
'type': 'string',
|
||||||
|
},
|
||||||
|
#'thumbnail': {
|
||||||
|
# 'type': 'string',
|
||||||
|
#},
|
||||||
|
#'preview': {
|
||||||
|
# 'type': 'string',
|
||||||
|
#},
|
||||||
|
#'binary_data': {
|
||||||
|
# 'type': 'media',
|
||||||
|
#},
|
||||||
|
'path': {
|
||||||
|
'type': 'string',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'form_schema': {
|
||||||
|
'contentType': {},
|
||||||
|
'length': {},
|
||||||
|
'uploadDate': {
|
||||||
|
'dateonly': True,
|
||||||
|
},
|
||||||
|
'md5': {},
|
||||||
|
'filename': {},
|
||||||
|
'binary_data': {},
|
||||||
|
'path': {},
|
||||||
|
},
|
||||||
|
'parent': {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
from pymongo import MongoClient
|
from pymongo import MongoClient
|
||||||
|
|
||||||
@@ -238,5 +284,15 @@ def populate_node_types(old_ids={}):
|
|||||||
post_item('node_types', task_node_type)
|
post_item('node_types', task_node_type)
|
||||||
|
|
||||||
|
|
||||||
|
task_name = file_node_type['name']
|
||||||
|
if task_name in old_ids:
|
||||||
|
file_node_type = mix_node_type(old_ids[task_name], file_node_type)
|
||||||
|
# Remove old node_type
|
||||||
|
db.node_types.remove({'_id':old_ids[task_name]})
|
||||||
|
# Insert new node_type
|
||||||
|
db.node_types.insert(file_node_type)
|
||||||
|
else:
|
||||||
|
post_item('node_types', file_node_type)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
manager.run()
|
manager.run()
|
||||||
|
@@ -8,6 +8,9 @@ RESOURCE_METHODS = ['GET', 'POST', 'DELETE']
|
|||||||
# Enable reads (GET), edits (PATCH), replacements (PUT) and deletes of
|
# Enable reads (GET), edits (PATCH), replacements (PUT) and deletes of
|
||||||
# individual items (defaults to read-only item access).
|
# individual items (defaults to read-only item access).
|
||||||
ITEM_METHODS = ['GET', 'PUT', 'DELETE', 'PATCH']
|
ITEM_METHODS = ['GET', 'PUT', 'DELETE', 'PATCH']
|
||||||
|
# EXTENDED_MEDIA_INFO = ['_id', 'content_type', 'name', 'length']
|
||||||
|
RETURN_MEDIA_AS_URL = True
|
||||||
|
RETURN_MEDIA_AS_BASE64_STRING = False
|
||||||
|
|
||||||
PAGINATION_LIMIT = 100
|
PAGINATION_LIMIT = 100
|
||||||
|
|
||||||
@@ -47,7 +50,7 @@ nodes_schema = {
|
|||||||
'maxlength': 128,
|
'maxlength': 128,
|
||||||
},
|
},
|
||||||
'picture': {
|
'picture': {
|
||||||
'type': 'media'
|
'type': 'objectid'
|
||||||
},
|
},
|
||||||
'order': {
|
'order': {
|
||||||
'type': 'integer',
|
'type': 'integer',
|
||||||
|
Reference in New Issue
Block a user