diff --git a/rest_framework/fields.py b/rest_framework/fields.py index 0be6a7c12..c0ceebe3b 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -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]) diff --git a/rest_framework/relations.py b/rest_framework/relations.py index 3c2132c5b..338776884 100644 --- a/rest_framework/relations.py +++ b/rest_framework/relations.py @@ -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