Incorporate @Macrobb metadata widget and content visual changes.
GitLab issue #378 Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
from __future__ import unicode_literals
|
||||
from django.utils.html import format_html_join
|
||||
|
||||
|
||||
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()
|
||||
]
|
||||
return format_html_join(
|
||||
'\n', '<div class="metadata-display"><b>{}: </b><span data-metadata-type="{}" data-pk="{}">{}</span></div>',
|
||||
((document_metadata.metadata_type,document_metadata.metadata_type_id,document_metadata.id,document_metadata.value)
|
||||
for document_metadata in document.metadata.all()
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user