Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- == App model ==
- class Target(Document):
- Age = IntField()
- Gender = StringField(max_length=1,choices=(('M','Male'),('F','Female')))
- Videos = SortedListField(EmbeddedDocumentField(ContentRating))
- ==Django shell ==
- t=Target(Age=24,Gender='M')
- t.Videos.append(cr)
- t.save()
- Traceback (most recent call last):
- File "<console>", line 1, in <module>
- File "/usr/local/lib/python2.6/dist-packages/mongoengine-0.4-py2.6.egg/mongoengine/document.py", line 73, in save
- self.validate()
- File "/usr/local/lib/python2.6/dist-packages/mongoengine-0.4-py2.6.egg/mongoengine/base.py", line 357, in validate
- field._validate(value)
- File "/usr/local/lib/python2.6/dist-packages/mongoengine-0.4-py2.6.egg/mongoengine/base.py", line 92, in _validate
- % unicode(self.choices))
- ValidationError: Value must be one of (('M', 'Male'), ('F', 'Female')).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement