Browse Source

Config de data e hora

pull/752/head
LeandroRoberto 8 years ago
parent
commit
51e542300b
  1. 6
      sapl/crispy_layout_mixin.py
  2. 4
      sapl/materia/views.py
  3. 6
      sapl/settings.py
  4. 2
      sapl/templates/compilacao/textoarticulado_list.html

6
sapl/crispy_layout_mixin.py

@ -1,12 +1,12 @@
from math import ceil
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 import template
from django.utils import formats
from django.utils.translation import ugettext as _
import rtyaml
def heads_and_tails(list_of_lists):
@ -62,9 +62,11 @@ def get_field_display(obj, fieldname):
else:
value = getattr(obj, fieldname)
str_type = str(type(value))
if value is None:
display = ''
elif 'date' in str(type(value)):
elif 'date' in str_type:
display = formats.date_format(value, "SHORT_DATE_FORMAT")
elif 'bool' in str(type(value)):
display = _('Sim') if value else _('Não')

4
sapl/materia/views.py

@ -476,13 +476,13 @@ class ProposicaoCrud(Crud):
obj.data_envio = 'Em elaboração...'
else:
obj.data_envio = formats.date_format(
obj.data_envio, "DATE_FORMAT")
obj.data_envio, "DATETIME_FORMAT")
if obj.data_recebimento is None:
obj.data_recebimento = 'Não recebida'
else:
obj.data_envio = formats.date_format(
obj.data_recebimento, "DATE_FORMAT")
obj.data_recebimento, "DATETIME_FORMAT")
return [self._as_row(obj) for obj in object_list]

6
sapl/settings.py

@ -177,10 +177,12 @@ LANGUAGES = (
TIME_ZONE = 'America/Sao_Paulo'
USE_I18N = True
USE_L10N = False
USE_TZ = True
USE_TZ = False
# DATE_FORMAT = 'N j, Y'
DATE_FORMAT = 'd/m/Y H:i'
DATE_FORMAT = 'd/m/Y'
SHORT_DATE_FORMAT = 'd/m/Y'
DATETIME_FORMAT = 'd/m/Y H:i:s'
SHORT_DATETIME_FORMAT = 'd/m/Y H:i'
DATE_INPUT_FORMATS = ('%d/%m/%Y', '%m-%d-%Y', '%Y-%m-%d')
LOCALE_PATHS = (

2
sapl/templates/compilacao/textoarticulado_list.html

@ -32,7 +32,7 @@
<td><a href="{% url 'sapl.compilacao:ta_detail' ta.pk %}">{{ ta.tipo_ta }}</a></td>
<td>{{ ta.numero }}</td>
<td>{{ ta.ano }}</td>
<td>{{ ta.data }}</td>
<td>{{ ta.data|date:"D d M Y" }}</td>
<td>{{ ta.ementa|safe }}</td>
</tr>
{% endfor %}

Loading…
Cancel
Save