Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3705 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 12 15
4559
3
thg 11 15
12903
1
thg 11 15
6279
2
thg 5 22
33939
0
thg 3 19
4056