請問在早期的Edit 寫法Form要怎麼綁定資料

1 view
Skip to first unread message

SeedSeek

unread,
Jan 15, 2012, 9:34:34 AM1/15/12
to Uliweb
if request.method == 'GET':
return {'form':form, 'ok':False}

類似這種寫法,Edit 要如何綁定資料?

感謝

SeedSeek

unread,
Jan 15, 2012, 7:32:46 PM1/15/12
to Uliweb
找到囉
form(data=data)

limodou

unread,
Jan 15, 2012, 8:15:01 PM1/15/12
to uli...@googlegroups.com
2012/1/15 SeedSeek <frt5...@gmail.com>:

form有一个bind的函数,可以绑定数据。或者在创建form对象时传入data参数。

--
I like python!
UliPad <<The Python Editor>>: http://code.google.com/p/ulipad/
UliWeb <<simple web framework>>: http://code.google.com/p/uliweb/
My Blog: http://hi.baidu.com/limodou

SeedSeek

unread,
Jan 15, 2012, 9:07:14 PM1/15/12
to Uliweb
bind 有類似 dict 方法的綁定嗎? 就像data 直接傳入一樣

On Jan 16, 9:15 am, limodou <limo...@gmail.com> wrote:
> 2012/1/15 SeedSeek <frt524...@gmail.com>:

limodou

unread,
Jan 15, 2012, 9:10:31 PM1/15/12
to uli...@googlegroups.com
2012/1/16 SeedSeek <frt5...@gmail.com>:

> bind 有類似 dict 方法的綁定嗎? 就像data 直接傳入一樣
>

def bind(self, data=None, errors=None):

form(data=data)就是调用bind来处理的。

Reply all
Reply to author
Forward
0 new messages