rajpy
rajpy

Reputation: 2476

Adding extra properties to the User class in App Engine datastore?

I am working on an App using Flask and App Engine, which requires extra information to be stored in User Object apart from nickname, email and user_id. Is it possible to extend User class in datastore?

If not, is there is any workaround? I am planning to have my own User model. So, once user logs into the app(using google authentication), I would collect user info using users.get_current_user() function and also add some other extra fields I require. All these information will get stored in my own User model. Is it the right way to handle this situation?

Upvotes: 0

Views: 402

Answers (1)

Daniel Roseman
Daniel Roseman

Reputation: 599490

As I explained in your other question, you need a separate class. User is not a model, and it is not stored in the datastore. It's simply a combination of the user_id and email that are obtained from Google's accounts system when you log in. If you want to store something about the user, you need to create your own model class, and use store user_id and/or email as fields which you compare against the logged-in user.

Upvotes: 2

Related Questions