mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-27 08:29:59 +03:00
make github actions formatting happy.
This commit is contained in:
parent
dca1b5bc0e
commit
1f3caf5f71
|
@ -86,7 +86,6 @@ class ErrorDetail(str):
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"ErrorDetail(string='{str(self)}', code='{self.code}')"
|
return f"ErrorDetail(string='{str(self)}', code='{self.code}')"
|
||||||
|
|
||||||
|
|
||||||
def __hash__(self):
|
def __hash__(self):
|
||||||
return hash(str(self))
|
return hash(str(self))
|
||||||
|
|
||||||
|
|
|
@ -236,9 +236,9 @@ class OrderingFilter(BaseFilterBackend):
|
||||||
(field.source.replace('.', '__') or field_name, field.label)
|
(field.source.replace('.', '__') or field_name, field.label)
|
||||||
for field_name, field in serializer_class(context=context).fields.items()
|
for field_name, field in serializer_class(context=context).fields.items()
|
||||||
if (
|
if (
|
||||||
not getattr(field, 'write_only', False) and
|
not getattr(field, 'write_only', False) and
|
||||||
not field.source == '*' and
|
not field.source == '*' and
|
||||||
field.source not in model_property_names
|
field.source not in model_property_names
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -411,9 +411,9 @@ class HyperlinkedRelatedField(RelatedField):
|
||||||
if value in ('', None):
|
if value in ('', None):
|
||||||
value_string = {'': 'the empty string', None: 'None'}[value]
|
value_string = {'': 'the empty string', None: 'None'}[value]
|
||||||
msg += (
|
msg += (
|
||||||
" WARNING: The value of the field on the model instance "
|
" WARNING: The value of the field on the model instance "
|
||||||
f"was {value_string}, which may be why it didn't match any "
|
f"was {value_string}, which may be why it didn't match any "
|
||||||
"entries in your URL conf."
|
"entries in your URL conf."
|
||||||
)
|
)
|
||||||
raise ImproperlyConfigured(msg % self.view_name)
|
raise ImproperlyConfigured(msg % self.view_name)
|
||||||
|
|
||||||
|
|
|
@ -153,8 +153,7 @@ class Request:
|
||||||
negotiator=None, parser_context=None):
|
negotiator=None, parser_context=None):
|
||||||
assert isinstance(request, HttpRequest), (
|
assert isinstance(request, HttpRequest), (
|
||||||
'The `request` argument must be an instance of '
|
'The `request` argument must be an instance of '
|
||||||
'`django.http.HttpRequest`, not `{}.{}`.'
|
f'`django.http.HttpRequest`, not `{request.__class__.__module__}.{request.__class__.__name__}`.' # noqa
|
||||||
.format(request.__class__.__module__, request.__class__.__name__)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
self._request = request
|
self._request = request
|
||||||
|
|
|
@ -219,7 +219,7 @@ def format_value(value):
|
||||||
elif isinstance(value, str):
|
elif isinstance(value, str):
|
||||||
if (
|
if (
|
||||||
(value.startswith('http:') or value.startswith('https:')) and not
|
(value.startswith('http:') or value.startswith('https:')) and not
|
||||||
re.search(r'\s', value)
|
re.search(r'\s', value)
|
||||||
):
|
):
|
||||||
return mark_safe('<a href="{value}">{value}</a>'.format(value=escape(value)))
|
return mark_safe('<a href="{value}">{value}</a>'.format(value=escape(value)))
|
||||||
elif '@' in value and not re.search(r'\s', value):
|
elif '@' in value and not re.search(r'\s', value):
|
||||||
|
|
|
@ -70,9 +70,9 @@ class ErrorDetailTests(TestCase):
|
||||||
|
|
||||||
def test_repr(self):
|
def test_repr(self):
|
||||||
assert repr(ErrorDetail('msg1')) == \
|
assert repr(ErrorDetail('msg1')) == \
|
||||||
f"ErrorDetail(string='msg1', code='None')"
|
"ErrorDetail(string='msg1', code='None')"
|
||||||
assert repr(ErrorDetail('msg1', 'code')) == \
|
assert repr(ErrorDetail('msg1', 'code')) == \
|
||||||
f"ErrorDetail(string='msg1', code='code')"
|
"ErrorDetail(string='msg1', code='code')"
|
||||||
|
|
||||||
def test_str(self):
|
def test_str(self):
|
||||||
assert str(ErrorDetail('msg1')) == 'msg1'
|
assert str(ErrorDetail('msg1')) == 'msg1'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user