Skip to content

if field is unique,“Already exists.” not translation #1

New issue

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions flask_admin/contrib/sqla/validators.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from sqlalchemy.orm.exc import NoResultFound

from flask_admin.babel import gettext, ngettext
from wtforms import ValidationError
try:
from wtforms.validators import InputRequired
Expand Down Expand Up @@ -39,7 +39,7 @@ def __call__(self, form, field):

if not hasattr(form, '_obj') or not form._obj == obj:
if self.message is None:
self.message = field.gettext(u'Already exists.')
self.message = gettext(u'Already exists.')
raise ValidationError(self.message)
except NoResultFound:
pass
Expand All @@ -57,7 +57,7 @@ def __init__(self, min=1, message=None):
def __call__(self, form, field):
if len(field.data) < self.min:
if self.message is None:
message = field.ngettext(
message = ngettext(
u"At least %(num)d item is required",
u"At least %(num)d items are required",
self.min
Expand Down