From 065de8bdaf0567731a8ab71de476a1f50f9155b2 Mon Sep 17 00:00:00 2001 From: Edward Ribeiro Date: Wed, 20 Apr 2016 11:55:29 -0300 Subject: [PATCH] Fix #43 --- crispy_layout_mixin.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crispy_layout_mixin.py b/crispy_layout_mixin.py index 0d15ad76d..89ce0048f 100644 --- a/crispy_layout_mixin.py +++ b/crispy_layout_mixin.py @@ -61,6 +61,15 @@ def get_field_display(obj, fieldname): display = formats.date_format(value, "SHORT_DATE_FORMAT") elif 'bool' in str(type(value)): display = _('Sim') if value else _('Não') + elif 'ImageFieldFile' in str(type(value)): + display = ''.format(value.url) + elif 'FieldFile' in str(type(value)): + if value: + display = '{}'.format( + value.url, + value.name.split('/')[-1:][0]) + else: + display = '' else: display = str(value) return verbose_name, display