Note that there are some explanatory texts on larger screens.

plurals
  1. POCheck if item is in date, else print default
    text
    copied!<p>I have a list of objects Im trying to get by months, my problem is not every object has date for every month.</p> <p>I tried like this:</p> <pre><code>{% regroup object_list|dictsort:"store.id" by store as store_list %} &lt;ul&gt; {% for store in store_list %} &lt;li&gt;{{ store.grouper }} {% regroup store.list|dictsort:"product" by product as product_list %} &lt;ul&gt; {% for product in product_list %} &lt;li&gt;{{ product.grouper }} &lt;ul&gt; {% for item in product.list|dictsort:"date" %} &lt;li&gt;{{ item.price }} - {{ item.date|date }}&lt;/li&gt; {% endfor %} &lt;/ul&gt; &lt;/li&gt; {% endfor %} &lt;/ul&gt; &lt;/li&gt; {% endfor %} &lt;/ul&gt; </code></pre> <p>This give me:</p> <ul> <li>Apple <ul> <li>iMac <ul> <li>395 - jun. 1, 2013</li> <li>395 - jul. 1, 2013</li> <li>395 - aug. 1, 2013</li> <li>395 - sept. 1, 2013</li> <li>395 - oct. 1, 2013</li> <li>395 - nov. 1, 2013</li> </ul> </li> <li>Macbook <ul> <li>499 - nov. 1, 2013</li> </ul> </li> </ul> </li> </ul> <p>I would like it to display like this:</p> <ul> <li>Apple <ul> <li>iMac <ul> <li>MISSING VALUE - jan. 1, 2013</li> <li>MISSING VALUE - feb. 1, 2013</li> <li>MISSING VALUE - mar. 1, 2013</li> <li>MISSING VALUE - apr. 1, 2013</li> <li>MISSING VALUE - may. 1, 2013</li> <li>395 - jun. 1, 2013</li> <li>395 - jul. 1, 2013</li> <li>395 - aug. 1, 2013</li> <li>395 - sept. 1, 2013</li> <li>395 - oct. 1, 2013</li> <li>395 - nov. 1, 2013</li> <li>MISSING VALUE - des. 1, 2013</li> </ul> </li> </ul> </li> </ul> <p>Anyone knwo if it is possible to do it?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload