diff --git a/crispy_layout_mixin.py b/crispy_layout_mixin.py index 7971466ca..0d15ad76d 100644 --- a/crispy_layout_mixin.py +++ b/crispy_layout_mixin.py @@ -5,6 +5,7 @@ import rtyaml from crispy_forms.bootstrap import FormActions from crispy_forms.helper import FormHelper from crispy_forms.layout import HTML, Div, Fieldset, Layout, Submit +from django.utils import formats from django.utils.translation import ugettext as _ @@ -57,9 +58,9 @@ def get_field_display(obj, fieldname): if value is None: display = '' elif 'date' in str(type(value)): - display = value.strftime("%d/%m/%Y") # TODO: localize + display = formats.date_format(value, "SHORT_DATE_FORMAT") elif 'bool' in str(type(value)): - display = 'Sim' if value else 'Não' + display = _('Sim') if value else _('Não') else: display = str(value) return verbose_name, display diff --git a/protocoloadm/views.py b/protocoloadm/views.py index fa0056044..8757debd4 100644 --- a/protocoloadm/views.py +++ b/protocoloadm/views.py @@ -67,7 +67,7 @@ class ProtocoloPesquisaView(FormView): # kwargs['final'] = request.POST['final'] # if request.POST['natureza_processo']: - # kwargs['natureza_processo'] = request.POST['natureza_processo'] + # kwargs['natureza_processo'] = request.POST['natureza_processo'] if request.POST['tipo_documento']: kwargs['tipo_documento'] = request.POST['tipo_documento'] @@ -238,6 +238,7 @@ class ComprovanteProtocoloView(TemplateView): autenticacao = _("** NULO **") if not protocolo.anulado: + # data is not i18n sensitive 'Y-m-d' is the right format. autenticacao = str(protocolo.tipo_processo) + \ protocolo.data.strftime("%Y/%m/%d") + \ str(protocolo.numero).zfill(6)