The template code for that would be:
{% load i18n %}
{% now "n" as current_month %}
{% with month=current_month|add:"-1" %}
{% if month == 1 %}
{% trans "January" %}
{% elif month == 2 %}
{% trans "February" %}
{% elif month == 3 %}
{% trans "March" %}
{% elif month == 4 %}
{% trans "April" %}
...
{% elif month == 0 %}
{% trans "December" %}
{% endif %}
{% endwith %}
If you plan to use this as the default for a lookup I would recommend not
using the translated name and remove the use of i18n..
To test it from the command line use:
./manage.py shell
or (depending on how you installed)
mayan-edms.py shell
from django.template import Context, Template
Template('{% load i18n %}{% now "n" as current_month %}{% with
month=current_month|add:"-1" %}{% if month == 1 %}{% trans "January" %}{%
elif month == 2 %}{% trans "February" %}{% elif month == 3 %}{% trans
"March" %}{% endif %}{% endwith %}').render(context=Context())
Out[37]: u'March'
On Sunday, April 9, 2017 at 3:15:23 PM UTC-4, Manuel Reiter wrote:
>
> Can this be achieved somehow? I managed to get "this month's name" via "{%
> now "F" %}" but I usually file last month's credit card statements. Any
> ideas?
>
> Thanks,
>
> Manuel
>
--
---
You received this message because you are subscribed to the Google Groups
"Mayan EDMS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.