Commit 6bbb2890 by Xavier Ordoquy

Merge pull request #3701 from Cheglader/master

Fix #3628 by implementing __getnewargs__()
parents b8d109f2 4b59681c
......@@ -32,6 +32,9 @@ class Hyperlink(six.text_type):
ret.name = name
return ret
def __getnewargs__(self):
return(str(self), self.name,)
is_hyperlink = True
......
......@@ -206,3 +206,14 @@ class TestManyRelatedField(APISimpleTestCase):
mvd = MultiValueDict({'baz': ['bar1', 'bar2']})
assert empty == self.field.get_value(mvd)
class TestHyperlink:
def setup(self):
self.default_hyperlink = serializers.Hyperlink('http://example.com', 'test')
def test_can_be_pickled(self):
import pickle
upkled = pickle.loads(pickle.dumps(self.default_hyperlink))
assert upkled == self.default_hyperlink
assert upkled.name == self.default_hyperlink.name
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment