本文整理汇总了Python中documents.models.Document.description方法的典型用法代码示例。如果您正苦于以下问题:Python Document.description方法的具体用法?Python Document.description怎么用?Python Document.description使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类documents.models.Document
的用法示例。
在下文中一共展示了Document.description方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: upload_single_file
# 需要导入模块: from documents.models import Document [as 别名]
# 或者: from documents.models.Document import description [as 别名]
def upload_single_file(self, file_object, filename=None, use_file_name=False, document_type=None, metadata_dict_list=None, user=None, document=None, new_version_data=None, description=None):
new_document = not document
if not document:
document = Document()
if document_type:
document.document_type = document_type
if description:
document.description = description
document.save()
apply_default_acls(document, user)
if user:
document.add_as_recent_document_for_user(user)
create_history(HISTORY_DOCUMENT_CREATED, document, {'user': user})
else:
create_history(HISTORY_DOCUMENT_CREATED, document)
else:
if use_file_name:
filename = None
else:
filename = filename if filename else document.latest_version.filename
if description:
document.description = description
document.save()
if not new_version_data:
new_version_data = {}
new_version = document.new_version(file=file_object, user=user, **new_version_data)
if filename:
document.rename(filename)
transformations, errors = self.get_transformation_list()
new_version.apply_default_transformations(transformations)
# TODO: new HISTORY for version updates
if metadata_dict_list and new_document:
# Only do for new documents
save_metadata_list(metadata_dict_list, document, create=True)
warnings = update_indexes(document)