Skip to content

agregar funciones a la plantilla jinja

  1. #—libs/date.py
  2. def format_date(value, format=“%d/%m/%Y %H:%M:%S”):
  3. ย  ย  ย  ย  return value.strftime(format)
  4. #—–settings
  5. from libs.filters import format_date
  6. from jinja2 import Environment, FileSystemLoader
  7. TEMPLATE_ENV.filters[“format_date”] = format_date
  8. #—template
  9. <td>{{ h.date|format_date(‘%d/%m/%Y’) }}</td>