Add basic views for IFPS PLU Codes

This commit is contained in:
Lance Edgar 2020-12-06 19:36:23 -06:00
parent 3250347df1
commit ac5139b7c4
3 changed files with 113 additions and 0 deletions

View file

@ -887,6 +887,18 @@ class MasterView(View):
'importer_host_title': importer_host_title,
})
def render_truncated_value(self, obj, field):
"""
Simple renderer which truncates the (string) value to 100 chars.
"""
value = getattr(obj, field)
if value is None:
return ""
value = six.text_type(value)
if len(value) > 100:
value = value[:100] + '...'
return value
def render_id_str(self, obj, field):
"""
Render the ``id_str`` attribute value for the given object.