This question has been flagged
2455 Views

Hello my friends!!

I am trying to call a python function in a mako file.

I have tried but i have got an error.

python:

def get_date(self, context=None): 

obj = {}

res_list=[]

obj['date_from'] = datetime.now().strftime('%Y-%m-%d')

res_list.append(obj)

return res_list

Mako:

%for item in get_date():

<tr style='height:8.5pt'>

<td width=214 style='width:160.5pt;border-left:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;

background:#FCE4D6;padding:0cm 3.5pt 0cm 3.5pt;height:8.5pt'>

<p class=MsoNormal align=right style='margin-bottom:0cm;margin-bottom:.0001pt;

text-align:right;text-indent:8.05pt;line-height:normal'><b><span

style='font-size:8.0pt;font-family:"Arial","sans-serif";color:black'>${item.date_from}</span></b></p>

</td>

</tr>

%endfor

Please, need an answer

Regards

Avatar
Discard