0

I am a new comer to CB and I'm working on a project in which I need to pass a list of the previous 12 months from today's date to the view, in the fashion of Year,Month, so that the view writes something as follows for each.

<div class="date">
      <h4>2103</h4>
      <div<JAN</div>
 </div>

I haven't been able to figure out a variable schema in order to properly reference the elements on the view.

halfelf
  • 9,737
  • 13
  • 54
  • 63
lfurrea
  • 176
  • 1
  • 10

1 Answers1

0

This was answered elsewhere, so I am filling in for reference.

A list of lists do the job:

On Controller:

Dates = [ [{year, "2013"}, {month, "JAN"}], [{year, "2013"}, {month, "FEB"}] ],

and pass the var to the template: {dates, Dates}

On view:

{% for date in dates %}
    Year: {{ date.year }}<br>
    Month: {{ date.month }}<br>
{% endfor %}
lfurrea
  • 176
  • 1
  • 10