A quick question: I want to create headers on the news page indicating which month year articles have been created - something like grouped by month year. I did it in the template passing variables from the previous article when iterating batch. Is there a better way?
Currently, I am overriding the listing.pt template:
<tal:block tal:define="...; item_month_created python:item.effective.strftime('%B %Y'); item_month_visible python:True if item_month_created != item_month_previous else False; "> <h3 class="month" tal:condition="python: item_month_visible" tal:content="python: item_month_created.capitalize()">November 2019</h3> <?python item_month_previous = item_month_created ?>
And while doing that, I noticed the month names don't get localized. I had to set
locale.setlocale(locale.LC_TIME, "sl_SI") in the view to activate the Slovenian localization - it is set to
('en_US', 'UTF-8') by default although I have the language set to Slovenian in Site settings.