本文整理匯總了Python中mongoengine.EmailField方法的典型用法代碼示例。如果您正苦於以下問題:Python mongoengine.EmailField方法的具體用法?Python mongoengine.EmailField怎麽用?Python mongoengine.EmailField使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類mongoengine
的用法示例。
在下文中一共展示了mongoengine.EmailField方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: models
# 需要導入模塊: import mongoengine [as 別名]
# 或者: from mongoengine import EmailField [as 別名]
def models():
class HeadTeacher(me.EmbeddedDocument):
full_name = me.StringField(max_length=255, unique=True, default='noname')
class Course(me.Document):
id = me.IntField(primary_key=True)
name = me.StringField()
# These are for better model form testing
cost = me.IntField()
description = me.StringField()
level = me.StringField(choices=('Primary', 'Secondary'))
prereqs = me.DictField()
started = me.DateTimeField()
grade = AnotherIntegerField()
students = me.ListField(me.ReferenceField('Student'))
class School(me.Document):
name = me.StringField()
students = me.ListField(me.ReferenceField('Student'))
headteacher = me.EmbeddedDocumentField(HeadTeacher)
class Student(me.Document):
full_name = me.StringField(max_length=255, unique=True, default='noname')
age = me.IntField(min_value=10, max_value=99)
dob = me.DateTimeField(null=True)
date_created = me.DateTimeField(default=dt.datetime.utcnow,
help_text='date the student was created')
current_school = me.ReferenceField('School')
courses = me.ListField(me.ReferenceField('Course'))
email = me.EmailField(max_length=100)
profile_uri = me.URLField(max_length=200)
# So that we can access models with dot-notation, e.g. models.Course
class _models(object):
def __init__(self):
self.HeadTeacher = HeadTeacher
self.Course = Course
self.School = School
self.Student = Student
return _models()
示例2: test_should_email_convert_string
# 需要導入模塊: import mongoengine [as 別名]
# 或者: from mongoengine import EmailField [as 別名]
def test_should_email_convert_string():
assert_conversion(mongoengine.EmailField, graphene.String)