开发者

User as a model in Google App Engine's `webapp`

开发者 https://www.devze.com 2023-02-14 16:47 出处:网络
I\'m using开发者_运维百科 Google App Engine in Python using Google\'s webapp framework. I want to have User as a model in my app, so I can give it various properties. e.g. I want to give it a boolean

I'm using开发者_运维百科 Google App Engine in Python using Google's webapp framework.

I want to have User as a model in my app, so I can give it various properties. e.g. I want to give it a boolean property active. But since webapp has its own way of handling users, I don't know how to do that so I am using webapp's users but I'm still able to define my properties on them. Does anyone have an idea?


One option would be to create a second model-- e.g. a SiteUser model, and then make a field on SiteUser to relate it with the corresponding user that the framework provides. You could then add whatever properties you wanted onto the SiteUser model.

Wherever you currently check the properties on the framework-provided user, you could retrieve the corresponding SiteUser and check its properties.

0

精彩评论

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