We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In django: https://docs.djangoproject.com/en/dev/ref/models/instances/?from=olddocs#django.db.models.Model.clean
https://github.com/django/django/blob/stable/1.4.x/django/db/models/base.py#L617 https://github.com/django/django/blob/stable/1.4.x/django/db/models/base.py#L809
example:
class Person(Document): name = StringField() status = StringField() partner = ReferenceField() def clean(self): if self.status == 'married' and not self.partner: raise ValidationError("Partner is missing", field_name="partner") elif self.status == 'single': self.partner = None
The text was updated successfully, but these errors were encountered:
And when would that get called? in to_mongo?
Sorry, something went wrong.
in validate():
try: self.clean() except ValidationError, e: errors = e.update_error_dict(errors)
Added clean method to documents for pre validation data cleaning (#60)
1986e82
In 0.8 - thanks for the code in #66 @wpjunior
Use Document clean method
4fc8ac8
See MongoEngine/mongoengine#60
No branches or pull requests
In django:
https://docs.djangoproject.com/en/dev/ref/models/instances/?from=olddocs#django.db.models.Model.clean
https://github.com/django/django/blob/stable/1.4.x/django/db/models/base.py#L617
https://github.com/django/django/blob/stable/1.4.x/django/db/models/base.py#L809
example:
The text was updated successfully, but these errors were encountered: