Skip to content

Commit b4db2df

Browse files
mehrabczrpkilby
authored andcommitted
Fixed no-cls-argument on staticmethod __new__ (#6960)
1 parent 30e56f6 commit b4db2df

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

rest_framework/fields.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1764,8 +1764,8 @@ def get_value(self, dictionary):
17641764
# When HTML form input is used, mark up the input
17651765
# as being a JSON string, rather than a JSON primitive.
17661766
class JSONString(str):
1767-
def __new__(self, value):
1768-
ret = str.__new__(self, value)
1767+
def __new__(cls, value):
1768+
ret = str.__new__(cls, value)
17691769
ret.is_json_string = True
17701770
return ret
17711771
return JSONString(dictionary[self.field_name])

rest_framework/relations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ class Hyperlink(str):
4646
We use this for hyperlinked URLs that may render as a named link
4747
in some contexts, or render as a plain URL in others.
4848
"""
49-
def __new__(self, url, obj):
50-
ret = str.__new__(self, url)
49+
def __new__(cls, url, obj):
50+
ret = str.__new__(cls, url)
5151
ret.obj = obj
5252
return ret
5353

0 commit comments

Comments
 (0)