user993563
user993563

Reputation: 19371

Creating a user profile using webapp2 on appengine

A very simple use case for creating users in webapp2/appengine can be as follows:

from google.appengine.api import users


class MainPage(webapp.RequestHandler):
    def get(self):
        user = users.get_current_user()

        if user:
            self.response.headers['Content-Type'] = 'text/plain'
            self.response.out.write('Hello, ' + user.nickname())
        else:
            self.redirect(users.create_login_url(self.request.uri))

But in case we want a user profile which has few more app specific tasks. Say a user can have address and phone number, few of his health info as bloodsugar etc. . How can we extend the user from the api to create a userprofile.

Upvotes: 1

Views: 297

Answers (1)

Daniel Roseman
Daniel Roseman

Reputation: 599490

Define a model with a property that links to a user: db.ReferenceProperty(users.User).

Upvotes: 4

Related Questions