mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 17:47:04 +03:00
use double quotes in user messages
This commit is contained in:
parent
662a907bdf
commit
9a4267049b
|
@ -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:
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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)
|
||||
))
|
||||
|
|
|
@ -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}."),
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user