models.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:arithmancer 作者: google 项目源码 文件源码
def check_if_user_profile(user_id):
  """Check if User has a profile, if not create a Profile."""
  profile_query = Profile.query(Profile.user_id == user_id).fetch()
  if len(profile_query) > 0:
    return True
  else:
    profile = Profile(
        user_id=users.get_current_user().user_id(),
        balance=100.00,
        user_email=users.get_current_user().email())
    profile.key = ndb.Key('Profile', users.get_current_user().user_id())
    profile_key = profile.put()
    return profile
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号