mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-18 04:20:53 +03:00
Fixed no-cls-argument on staticmethod __new__
(#6960)
This commit is contained in:
parent
30e56f62ba
commit
b4db2dfacf
|
@ -1764,8 +1764,8 @@ class JSONField(Field):
|
||||||
# When HTML form input is used, mark up the input
|
# When HTML form input is used, mark up the input
|
||||||
# as being a JSON string, rather than a JSON primitive.
|
# as being a JSON string, rather than a JSON primitive.
|
||||||
class JSONString(str):
|
class JSONString(str):
|
||||||
def __new__(self, value):
|
def __new__(cls, value):
|
||||||
ret = str.__new__(self, value)
|
ret = str.__new__(cls, value)
|
||||||
ret.is_json_string = True
|
ret.is_json_string = True
|
||||||
return ret
|
return ret
|
||||||
return JSONString(dictionary[self.field_name])
|
return JSONString(dictionary[self.field_name])
|
||||||
|
|
|
@ -46,8 +46,8 @@ class Hyperlink(str):
|
||||||
We use this for hyperlinked URLs that may render as a named link
|
We use this for hyperlinked URLs that may render as a named link
|
||||||
in some contexts, or render as a plain URL in others.
|
in some contexts, or render as a plain URL in others.
|
||||||
"""
|
"""
|
||||||
def __new__(self, url, obj):
|
def __new__(cls, url, obj):
|
||||||
ret = str.__new__(self, url)
|
ret = str.__new__(cls, url)
|
||||||
ret.obj = obj
|
ret.obj = obj
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user