Exemplo n.º 1
0
    def __call__(self, form, field):
        if self.group:
            existing = CoprsLogic.exists_for_group(self.group,
                                                   field.data).first()
        else:
            existing = CoprsLogic.exists_for_user(self.user,
                                                  field.data).first()

        if existing and str(existing.id) != form.id.data:
            raise wtforms.ValidationError(self.message.format(field.data))
Exemplo n.º 2
0
    def __call__(self, form, field):
        if self.group:
            existing = CoprsLogic.exists_for_group(
                self.group, field.data).first()
        else:
            existing = CoprsLogic.exists_for_user(
                self.user, field.data).first()

        if existing and str(existing.id) != form.id.data:
            raise wtforms.ValidationError(self.message.format(field.data))