Skip to content

Commit 75075cb

Browse files
authored
Merge branch 'main' into order
2 parents 2661f17 + 8e1edcd commit 75075cb

File tree

7 files changed

+20
-6
lines changed

7 files changed

+20
-6
lines changed

.readthedocs.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -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

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ any parts of the framework not mentioned in the documentation should generally b
1717
### Changed
1818

1919
* Added support to overwrite serializer methods in customized schema class
20+
* Adjusted some still old formatted strings to f-strings.
2021

2122
### Fixed
2223

docs/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
# General information about the project.
6262
project = "Django REST framework JSON:API"
6363
year = datetime.date.today().year
64-
copyright = "{}, Django REST framework JSON:API contributors".format(year)
64+
copyright = f"{year}, Django REST framework JSON:API contributors"
6565
author = "Django REST framework JSON:API contributors"
6666

6767
# The version info for the project you're documenting, acts as replacement for

rest_framework_json_api/django_filters/backends.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,5 +142,5 @@ def get_schema_operation_parameters(self, view):
142142
for res in result:
143143
if "name" in res:
144144
name = format_field_name(res["name"].replace("__", "."))
145-
res["name"] = "filter[{}]".format(name)
145+
res["name"] = f"filter[{name}]"
146146
return result

rest_framework_json_api/renderers.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def extract_relationships(cls, fields, resource, resource_instance):
160160
(relations.PrimaryKeyRelatedField, relations.HyperlinkedRelatedField),
161161
):
162162
resolved, relation = utils.get_relation_instance(
163-
resource_instance, "%s_id" % source, field.parent
163+
resource_instance, f"{source}_id", field.parent
164164
)
165165
if not resolved:
166166
continue
@@ -327,7 +327,7 @@ def extract_included(
327327
serializer_data = field.data
328328

329329
new_included_resources = [
330-
key.replace("%s." % field_name, "", 1)
330+
key.replace(f"{field_name}.", "", 1)
331331
for key in included_resources
332332
if field_name == key.split(".")[0]
333333
]

rest_framework_json_api/settings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def __init__(self, user_settings=settings, defaults=DEFAULTS):
3030

3131
def __getattr__(self, attr):
3232
if attr not in self.defaults:
33-
raise AttributeError("Invalid JSON:API setting: '%s'" % attr)
33+
raise AttributeError(f"Invalid JSON:API setting: '{attr}'")
3434

3535
value = getattr(
3636
self.user_settings, JSON_API_SETTINGS_PREFIX + attr, self.defaults[attr]

rest_framework_json_api/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def get_related_resource_type(relation):
264264
if hasattr(relation, "child_relation"):
265265
return get_related_resource_type(relation.child_relation)
266266
raise APIException(
267-
_("Could not resolve resource type for relation %s" % relation)
267+
_(f"Could not resolve resource type for relation {relation}")
268268
)
269269

270270
return get_resource_type_from_model(relation_model)

0 commit comments

Comments
 (0)