diff --git a/mayan/apps/metadata/api.py b/mayan/apps/metadata/api.py index d64c42cd93..a61e599d34 100644 --- a/mayan/apps/metadata/api.py +++ b/mayan/apps/metadata/api.py @@ -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(): diff --git a/mayan/apps/metadata/apps.py b/mayan/apps/metadata/apps.py index 4fe045bcc4..39c28f4cb7 100644 --- a/mayan/apps/metadata/apps.py +++ b/mayan/apps/metadata/apps.py @@ -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__) diff --git a/mayan/apps/metadata/widgets.py b/mayan/apps/metadata/widgets.py new file mode 100644 index 0000000000..8307a66d5c --- /dev/null +++ b/mayan/apps/metadata/widgets.py @@ -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() + ] + )