Move metadata widget code to metadata/widgets.py.
This commit is contained in:
@@ -100,15 +100,6 @@ def metadata_repr_as_list(metadata_list):
|
||||
return output
|
||||
|
||||
|
||||
def get_metadata_string(document):
|
||||
"""
|
||||
Return a formated representation of a document's metadata values
|
||||
"""
|
||||
return ', '.join(
|
||||
['%s - %s' % (document_metadata.metadata_type, document_metadata.value) for document_metadata in document.metadata.all()]
|
||||
)
|
||||
|
||||
|
||||
def convert_dict_to_dict_list(dictionary):
|
||||
result = []
|
||||
for key, value in dictionary.items():
|
||||
|
||||
@@ -22,7 +22,6 @@ from mayan.celery import app
|
||||
from navigation import SourceColumn
|
||||
from rest_api.classes import APIEndPoint
|
||||
|
||||
from .api import get_metadata_string
|
||||
from .classes import DocumentMetadataHelper
|
||||
from .handlers import (
|
||||
post_document_type_metadata_type_add,
|
||||
@@ -43,6 +42,7 @@ from .permissions import (
|
||||
permission_metadata_document_add, permission_metadata_document_edit,
|
||||
permission_metadata_document_remove, permission_metadata_document_view
|
||||
)
|
||||
from .widgets import get_metadata_string
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
14
mayan/apps/metadata/widgets.py
Normal file
14
mayan/apps/metadata/widgets.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
def get_metadata_string(document):
|
||||
"""
|
||||
Return a formated representation of a document's metadata values
|
||||
"""
|
||||
return ', '.join(
|
||||
[
|
||||
'%s - %s' % (
|
||||
document_metadata.metadata_type, document_metadata.value
|
||||
) for document_metadata in document.metadata.all()
|
||||
]
|
||||
)
|
||||
Reference in New Issue
Block a user