We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 2661f17 + 8e1edcd commit 75075cbCopy full SHA for 75075cb
.readthedocs.yaml
@@ -0,0 +1,13 @@
1
+version: 2
2
+
3
+build:
4
+ os: "ubuntu-22.04"
5
+ tools:
6
+ python: "3.8"
7
8
+sphinx:
9
+ configuration: docs/conf.py
10
11
+python:
12
+ install:
13
+ - requirements: docs/requirements.txt
CHANGELOG.md
@@ -17,6 +17,7 @@ any parts of the framework not mentioned in the documentation should generally b
17
### Changed
18
19
* Added support to overwrite serializer methods in customized schema class
20
+* Adjusted some still old formatted strings to f-strings.
21
22
### Fixed
23
docs/conf.py
@@ -61,7 +61,7 @@
61
# General information about the project.
62
project = "Django REST framework JSON:API"
63
year = datetime.date.today().year
64
-copyright = "{}, Django REST framework JSON:API contributors".format(year)
+copyright = f"{year}, Django REST framework JSON:API contributors"
65
author = "Django REST framework JSON:API contributors"
66
67
# The version info for the project you're documenting, acts as replacement for
rest_framework_json_api/django_filters/backends.py
@@ -142,5 +142,5 @@ def get_schema_operation_parameters(self, view):
142
for res in result:
143
if "name" in res:
144
name = format_field_name(res["name"].replace("__", "."))
145
- res["name"] = "filter[{}]".format(name)
+ res["name"] = f"filter[{name}]"
146
return result
rest_framework_json_api/renderers.py
@@ -160,7 +160,7 @@ def extract_relationships(cls, fields, resource, resource_instance):
160
(relations.PrimaryKeyRelatedField, relations.HyperlinkedRelatedField),
161
):
162
resolved, relation = utils.get_relation_instance(
163
- resource_instance, "%s_id"%source, field.parent
+ resource_instance, f"{source}_id", field.parent
164
)
165
if not resolved:
166
continue
@@ -327,7 +327,7 @@ def extract_included(
327
serializer_data = field.data
328
329
new_included_resources = [
330
- key.replace("%s."%field_name, "", 1)
+ key.replace(f"{field_name}.", "", 1)
331
for key in included_resources
332
if field_name == key.split(".")[0]
333
]
rest_framework_json_api/settings.py
@@ -30,7 +30,7 @@ def __init__(self, user_settings=settings, defaults=DEFAULTS):
30
31
def __getattr__(self, attr):
32
if attr not in self.defaults:
33
- raise AttributeError("Invalid JSON:API setting: '%s'"%attr)
+ raise AttributeError(f"Invalid JSON:API setting: '{attr}'")
34
35
value = getattr(
36
self.user_settings, JSON_API_SETTINGS_PREFIX + attr, self.defaults[attr]
rest_framework_json_api/utils.py
@@ -264,7 +264,7 @@ def get_related_resource_type(relation):
264
if hasattr(relation, "child_relation"):
265
return get_related_resource_type(relation.child_relation)
266
raise APIException(
267
- _("Could not resolve resource type for relation %s"%relation)
+ _(f"Could not resolve resource type for relation {relation}")
268
269
270
return get_resource_type_from_model(relation_model)
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments