本文整理汇总了Python中google.appengine.ext.db.UserProperty方法的典型用法代码示例。如果您正苦于以下问题:Python db.UserProperty方法的具体用法?Python db.UserProperty怎么用?Python db.UserProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类google.appengine.ext.db
的用法示例。
在下文中一共展示了db.UserProperty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: convert_UserProperty
# 需要导入模块: from google.appengine.ext import db [as 别名]
# 或者: from google.appengine.ext.db import UserProperty [as 别名]
def convert_UserProperty(model, prop, kwargs):
"""Returns a form field for a ``db.UserProperty``."""
return None
示例2: get_form_field
# 需要导入模块: from google.appengine.ext import db [as 别名]
# 或者: from google.appengine.ext.db import UserProperty [as 别名]
def get_form_field(self, **kwargs):
"""Return a Django form field appropriate for a User property.
This defaults to a forms.EmailField instance, except if auto_current_user or
auto_current_user_add is set, in which case None is returned, as such
'auto' fields should not be rendered as part of the form.
"""
if self.auto_current_user or self.auto_current_user_add:
return None
defaults = {'form_class': forms.EmailField}
defaults.update(kwargs)
return super(UserProperty, self).get_form_field(**defaults)
示例3: get_value_for_form
# 需要导入模块: from google.appengine.ext import db [as 别名]
# 或者: from google.appengine.ext.db import UserProperty [as 别名]
def get_value_for_form(self, instance):
"""Extract the property value from the instance for use in a form.
This returns the email address of the User.
"""
value = super(UserProperty, self).get_value_for_form(instance)
if not value:
return None
return value.email()