def validate_title(self, field): query = (Survey.query.with_parent(self.event) .filter(db.func.lower(Survey.title) == field.data.lower(), Survey.title != field.object_data, ~Survey.is_deleted)) if query.count(): raise ValidationError(_('There is already a survey named "{}" on this event').format(escape(field.data)))
def validate_title(self, field): query = Survey.find(Survey.event_id == self.event.id, db.func.lower(Survey.title) == field.data.lower(), Survey.title != field.object_data, ~Survey.is_deleted) if query.count(): raise ValidationError(_("There is already an survey named \"{}\" on this event".format(escape(field.data))))
def validate_body(self, field): missing = get_missing_placeholders('survey-link-email', field.data, event=None, survey=None) if missing: raise ValidationError( _('Missing placeholders: {}').format(', '.join(missing)))