Add other fields to datastore
Thanks for this example. Works perfectly, but I can't add another field to the datastore (User entity), for example email. Thanks in advance
You can go two ways about this. Either you create a new model that holds the additional fields like email, address and such. With a auth_key field. And use this when you need that information. Use mainly use this approach due that I find that I usually need this information quite rarely (for like profile pages and such).
The other way is to inherit from webapp2_extras.appengine.auth.models.User and add you own fields. And then change in webapp2 config (http://webapp-improved.appspot.com/api/webapp2_extras/config.html) to use you new model as auth.user_model.
Something like:
my_config['webapp2_extras.auth'] = { 'user_model': 'mymodule.myusermodel', }
app = webapp2.WSGIApplication(routes=[ webapp2.Route('/', name='home', handler=MyHandler) ]) app.config = webapp2_config.Config(my_config)
I'll try with the first one. BTW the second option doesn't work by defining a user_model, but you can add directly as params to create_user method
Thanks