mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-30 18:09:59 +03:00
Translate field names for UniqueTogetherValidator
Sorry to bother you. It might be a good idea to translate field names for the UniqueTogetherValidator message.
This commit is contained in:
parent
e3bd4b9048
commit
0d78d46ebd
|
@ -165,7 +165,8 @@ class UniqueTogetherValidator(object):
|
|||
value for field, value in attrs.items() if field in self.fields
|
||||
]
|
||||
if None not in checked_values and qs_exists(queryset):
|
||||
field_names = ', '.join(self.fields)
|
||||
from django.utils.translation import gettext
|
||||
field_names = ', '.join([gettext(field) for field in self.fields])
|
||||
message = self.message.format(field_names=field_names)
|
||||
raise ValidationError(message, code='unique')
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user