diff --git a/rest_framework/exceptions.py b/rest_framework/exceptions.py index 3ca8e5380..f8a43871b 100644 --- a/rest_framework/exceptions.py +++ b/rest_framework/exceptions.py @@ -95,7 +95,7 @@ class NotFound(APIException): class MethodNotAllowed(APIException): status_code = status.HTTP_405_METHOD_NOT_ALLOWED - default_detail = _("Method '{method}' not allowed.") + default_detail = _("Method \"{method}\" not allowed.") def __init__(self, method, detail=None): if detail is not None: @@ -118,7 +118,7 @@ class NotAcceptable(APIException): class UnsupportedMediaType(APIException): status_code = status.HTTP_415_UNSUPPORTED_MEDIA_TYPE - default_detail = _("Unsupported media type '{media_type}' in request.") + default_detail = _("Unsupported media type \"{media_type}\" in request.") def __init__(self, media_type, detail=None): if detail is not None: diff --git a/rest_framework/fields.py b/rest_framework/fields.py index 8a781b356..279446088 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -612,7 +612,7 @@ class RegexField(CharField): class SlugField(CharField): default_error_messages = { - 'invalid': _("Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens.") + 'invalid': _("Enter a valid \"slug\" consisting of letters, numbers, underscores or hyphens.") } def __init__(self, **kwargs): diff --git a/rest_framework/generics.py b/rest_framework/generics.py index c7053d8f3..738ba544a 100644 --- a/rest_framework/generics.py +++ b/rest_framework/generics.py @@ -120,12 +120,12 @@ class GenericAPIView(views.APIView): if page == 'last': page_number = paginator.num_pages else: - raise NotFound(_("Choose a valid page number. Page numbers must be a whole number, or must be the string 'last'.")) + raise NotFound(_("Choose a valid page number. Page numbers must be a whole number, or must be the string \"last\".")) try: page = paginator.page(page_number) except InvalidPage as exc: - error_format = _("Invalid page ({page_number}): {message}.") + error_format = _("Invalid page \"{page_number}\": {message}.") raise NotFound(error_format.format( page_number=page_number, message=six.text_type(exc) )) diff --git a/rest_framework/relations.py b/rest_framework/relations.py index 3737b21fa..42b624e7d 100644 --- a/rest_framework/relations.py +++ b/rest_framework/relations.py @@ -129,7 +129,7 @@ class StringRelatedField(RelatedField): class PrimaryKeyRelatedField(RelatedField): default_error_messages = { 'required': _("This field is required."), - 'does_not_exist': _("Invalid pk '{pk_value}' - object does not exist."), + 'does_not_exist': _("Invalid pk \"{pk_value}\" - object does not exist."), 'incorrect_type': _("Incorrect type. Expected pk value, received {data_type}."), } diff --git a/rest_framework/versioning.py b/rest_framework/versioning.py index 587ba9f13..819c32df8 100644 --- a/rest_framework/versioning.py +++ b/rest_framework/versioning.py @@ -36,7 +36,7 @@ class AcceptHeaderVersioning(BaseVersioning): Host: example.com Accept: application/json; version=1.0 """ - invalid_version_message = _("Invalid version in 'Accept' header.") + invalid_version_message = _("Invalid version in \"Accept\" header.") def determine_version(self, request, *args, **kwargs): media_type = _MediaType(request.accepted_media_type)