Python mongoengine.URLField() Examples
The following are 2
code examples of mongoengine.URLField().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
mongoengine
, or try the search function
.
Example #1
Source File: test_marshmallow_mongoengine.py From marshmallow-mongoengine with MIT License | 6 votes |
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()
Example #2
Source File: test_converter.py From graphene-mongo with MIT License | 5 votes |
def test_should_url_convert_string(): assert_conversion(mongoengine.URLField, graphene.String)