跳至内容
菜单
此问题已终结
3664 查看

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

形象
丢弃
相关帖文 回复 查看 活动
1
12月 15
4529
3
11月 15
12889
1
11月 15
6258
2
5月 22
33887
0
3月 19
4031