开发者

Django: FormWizard runs but one instance when it's URL is requested multiple times

I found out that the FormWizard only __init__'s once, when the url is request by multiple users at the same time (me in 2 browsers :).

This results in the fact that my temporarily stored data on the wizard's instance is wrongfully shared between users.

I'm doing some DB hits in t开发者_如何学运维he second step, and based on that outcome I do a conditional wrap-up in the done() method. code/description: Django FormWizard best .. well .. useful practices

Anybody have some advise on how to handle this?

Thanx a lot


After redoing the code of my 2 wizards, the solution that uses a dict on the FormWizard's instance now uses a nested dict with the session id as the name for the nested dict.

Thus instead of:

self.wizdata

I now use:

sk = request.session._session_key
self.wizdata[sk]

Example and full detail here.

Regards,

Gerard.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜