Fill array with ZERO in null spaces, (python / django)

1

The problem is in the parts marked in red , I can not assign zeros to it. According to model:

ThecodesnippetthatI'mgeneratingthistable:

* Note: The selection of this period may vary according to the selection: (eg 2016 until 2017/2015 until 2017 ...)

    
asked by anonymous 12.10.2017 / 20:23

1 answer

0

If the variables somatorio.3 and somatorio.2 are displaying the value None , you can use the default_if_none to translate them to zero.

In your case it would look like this:

<td class="text-center">{{ somatorio.3|default_if_none:"0" }}({{ somatorio.2|default_if_none:"0" }})</td>
    
12.10.2017 / 20:47