【问题标题】:How can I add user profile support to a google app engine app?如何将用户配置文件支持添加到谷歌应用引擎应用程序?
【发布时间】:2011-04-11 03:48:09
【问题描述】:

我有一个基于 django / django_appengine 的 Google App Engine 应用程序,我希望通过添加用户配置文件支持对其进行修改,因为基本用户模型对于我的情况来说有点简单。

最好的方法是什么?

【问题讨论】:

    标签: django google-app-engine django-profiles


    【解决方案1】:

    您可以创建一个名为 UserProfile 的模型,其密钥为用户的电子邮件地址或用户 ID。

    UserProfile profile = UserProfile.get_or_create(user.user_id) 将确保不会为现有用户 ID 创建任何用户配置文件。

    【讨论】:

    • user.user_id 仅适用于 google 帐户,不适用于 OpenID 帐户
    • 然后您可以使用电子邮件,或者您从get_current_user() 获得的User 的密钥
    猜你喜欢
    • 1970-01-01
    • 2011-12-26
    • 1970-01-01
    • 1970-01-01
    • 2020-11-18
    • 1970-01-01
    • 2020-11-21
    • 2016-05-02
    • 2020-07-29
    相关资源
    最近更新 更多