1

I need translate humanize to portuguese (pt-BR). How?

Import:

from django.contrib.humanize.templatetags.humanize import naturaltime

Using:

_question['pub_date'] = naturaltime(question.pub_date)

Settings:

LANGUAGE_CODE = 'pt-BR'

TIME_ZONE = 'America/Sao_Paulo'

USE_I18N = True

USE_L10N = True

USE_TZ = True

And in my template show this:

2 hours ago
GIA
  • 1,400
  • 2
  • 21
  • 38

1 Answers1

0

I just need set humanize inside template and works.

<span>{{question.pub_date|naturaltime}}</span>

You need add in installed apps too

'django.contrib.humanize',
GIA
  • 1,400
  • 2
  • 21
  • 38