mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-10 19:56:59 +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
|
||||
# as being a JSON string, rather than a JSON primitive.
|
||||
class JSONString(str):
|
||||
def __new__(self, value):
|
||||
ret = str.__new__(self, value)
|
||||
def __new__(cls, value):
|
||||
ret = str.__new__(cls, value)
|
||||
ret.is_json_string = True
|
||||
return ret
|
||||
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
|
||||
in some contexts, or render as a plain URL in others.
|
||||
"""
|
||||
def __new__(self, url, obj):
|
||||
ret = str.__new__(self, url)
|
||||
def __new__(cls, url, obj):
|
||||
ret = str.__new__(cls, url)
|
||||
ret.obj = obj
|
||||
return ret
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user