Browse Source

Ajusta Display de lista para Textos de Tradução

pull/691/head
LeandroRoberto 8 years ago
parent
commit
ffbc8e6c0c
  1. 4
      sapl/crispy_layout_mixin.py
  2. 5
      sapl/crud/base.py

4
sapl/crispy_layout_mixin.py

@ -1,12 +1,12 @@
from math import ceil from math import ceil
import rtyaml
from crispy_forms.bootstrap import FormActions from crispy_forms.bootstrap import FormActions
from crispy_forms.helper import FormHelper from crispy_forms.helper import FormHelper
from crispy_forms.layout import HTML, Div, Fieldset, Layout, Submit from crispy_forms.layout import HTML, Div, Fieldset, Layout, Submit
from django import template from django import template
from django.utils import formats from django.utils import formats
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
import rtyaml
def heads_and_tails(list_of_lists): def heads_and_tails(list_of_lists):
@ -54,7 +54,7 @@ def get_field_display(obj, fieldname):
field = obj._meta.get_field(fieldname) field = obj._meta.get_field(fieldname)
except: except:
value = getattr(obj, fieldname) value = getattr(obj, fieldname)
return '', value return '', str(value)
verbose_name = str(field.verbose_name)\ verbose_name = str(field.verbose_name)\
if hasattr(field, 'verbose_name') else '' if hasattr(field, 'verbose_name') else ''
if hasattr(field, 'choices') and field.choices: if hasattr(field, 'choices') and field.choices:

5
sapl/crud/base.py

@ -376,10 +376,7 @@ class CrudListView(PermissionRequiredContainerCrudMixin, ListView):
f = m._meta.get_field(f) f = m._meta.get_field(f)
if hasattr(f, 'related_model') and f.related_model: if hasattr(f, 'related_model') and f.related_model:
m = f.related_model m = f.related_model
if m == self.model: s.append(force_text(f.verbose_name))
s.append(force_text(f.verbose_name))
else:
s.append(force_text(f.verbose_name))
s = ' / '.join(s) s = ' / '.join(s)
r.append(s) r.append(s)
return r return r

Loading…
Cancel
Save