Thanks for the info - I've fixed it here:

https://github.com/stephenmcd/mezzanine/commit/cf7f7eadd138d9635751d2c2825492ef4749b238

On Thu, Jan 28, 2016 at 3:35 AM, Wim Feijen <[email protected]> wrote:

> Hi, I clarified the subject.
>
> I propose to pass the selected month in the blog archives as an integer to
> the template to solve the mentioned problem and will commit a pull request
> for this.
>
> WIm
>
> On Wednesday, 23 December 2015 15:43:15 UTC+1, Wim Feijen wrote:
>>
>> Hello,
>>
>> For my blog archive pages, I like to use a pull-down where the selected
>> month is selected.
>>
>> For that, I want to compare the selected year and month - which are in
>> the url, for example /blog/archive/2015/12/ and passed as context variables
>> into the template - and compare them with the year and month of all the
>> months in the archive pull-down.
>>
>> For me it gets difficult because the month from the url is converted
>> using a dictionary.
>>
>> See:
>> https://github.com/stephenmcd/mezzanine/blob/master/mezzanine/blog/views.py
>> line 4.  from calendar import month_name
>> line 38.  month = month_name[int(month)]
>>
>> My site is Dutch, but month_name gives me English names. In another
>> multilingual site, the English version works fine, but the Dutch site does
>> not. Compare:
>> https://www.roominreturn.nl/en/blog/archive/2015/7/
>> https://www.roominreturn.nl/nl/blog/archive/2015/7/
>>
>> What would be a proper solution?
>>
>> For me, one solution would be if the blog views passed the selected month
>> as an integer into the context. But maybe there are other solutions?
>>
>> Currently, I am using in my template:
>>                               <div id="archive">
>>                         {% with year as selected_year %}
>>                         {% with month as selected_month %}
>>                         {# YEAR: {{ selected_year }} MONTH: {{
>> selected_month }} for debugging #}
>>                         {% block blog_months %}
>>                             {% blog_months as months %}
>>                             {% if months %}
>>
>>                                 <h2 class="table-title">Nieuwsarchief</h2>
>>
>>                                 <select name="archive" class=""
>> id="archive-dropdown">
>>                                     <option value="/nieuws/">Kies een
>> maand...</option>
>>
>>                                     {% for month in months %}
>>
>>                                         {% ifchanged
>> archive_month.date.year %}
>>                                             <option value=""
>> disabled="disabled">{{ month.date.year }}</option>
>>                                         {% endifchanged %}
>>
>>                                         <option value="{% url
>> "blog_post_list_month" year=month.date.year month=month.date.month %}" {%
>> if month.date|date:"Y" == selected_year and month.date|date:"F" ==
>> selected_month|lower %} selected="selected" {% endif %}>
>>                                             {{ month.date|date:"F" }}
>>  ({{ month.post_count }})
>>
>>
>>                                         </option>
>>
>>                                     {% endfor %}
>>
>>                                 </select>
>>
>>                             {% endif %}
>>                         {% endblock %}
>>                         {% endwith %}
>>                         {% endwith %}
>>                     </div>
>>
>>
>> Thanks for your help!
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Mezzanine Users" 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.
>



-- 
Stephen McDonald
http://jupo.org

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" 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.

Reply via email to