User as a model in Google App Engine `webapp`

I am using the Google App Engine in Python using the Google framework webapp.

I want to have Useras a model in my application, so I can give it various properties. for example, I want to give it a boolean property active. But since it webapphas its own way of handling users, I don’t know how to do it, so I use users webapp, but I can still define my properties on them. Anyone have an idea?

+3
source share
1 answer

One option is to create a second model — for example, the SiteUser model, and then create a field on SiteUser to associate it with the appropriate user that the infrastructure provides. Then you can add all the properties that you would like to use in the SiteUser model.

In those cases when you are currently checking properties on a user provided by the infrastructure, you can get the appropriate SiteUser and check its properties.

+5
source

Source: https://habr.com/ru/post/1795538/


All Articles