我正在尝试为 Google App Engine 样板制作编辑配置文件板
当用户编辑配置文件时。模型为的用户实体
class User(User):
"""
Universal user model. Can be used with App Engine's default users API,
own auth or third party authentication methods (OpenId, OAuth etc).
based on https://gist.github.com/kylefinley
"""
#: Creation date.
created = model.DateTimeProperty(auto_now_add=True)
#: Modification date.
updated = model.DateTimeProperty(auto_now=True)
#: User defined unique name, also used as key_name.
username = model.StringProperty(required=True)
#: User Name
name = model.StringProperty()
#: User Last Name
last_name = model.StringProperty()
#: User email
email = model.StringProperty(required=True)
#: Password, only set for own authentication.
password = model.StringProperty(required=True)
#: User Country
country = model.StringProperty()
@classmethod
def get_by_email(cls, email):
"""Returns a user object based on an email.
:param email:
String representing the user email. Examples:
:returns:
A user object.
"""
return cls.query(cls.email == email).get()
我通过特定用户会话的代码获得了用户对象
user_info = models.User.get_by_id(long(self.user_id))
#Made required changes to to user object such as country name lastname
#saved the entity
user_info.put()
一切正常。用户实体已更新。但唯一实体不是。
我的主要问题是如何更新它们?
但是当我在管理视图中看到唯一表时
唯一表的图像是 https://www.dropbox.com/s/sfbsn63023gsxil/unique.png
此表未更新,但此表用于实体已更新。
用户表的图像是 https://www.dropbox.com/s/sfhw5l5ixdmlq7c/user.png
我应该怎么做才能更新数据存储中的唯一属性?