def validate_pattern(form, field): if not Document.is_pattern_valid(field.data): raise ValidationError(u'Podano nieprawidłowy wzorzec')
def before_insert(self, mapper, connection, instance): Document.obtain_number(instance)