mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-10 19:56:59 +03:00
Merge pull request #3701 from Cheglader/master
Fix #3628 by implementing __getnewargs__()
This commit is contained in:
commit
6bbb2890cb
|
@ -32,6 +32,9 @@ class Hyperlink(six.text_type):
|
||||||
ret.name = name
|
ret.name = name
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
def __getnewargs__(self):
|
||||||
|
return(str(self), self.name,)
|
||||||
|
|
||||||
is_hyperlink = True
|
is_hyperlink = True
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -206,3 +206,14 @@ class TestManyRelatedField(APISimpleTestCase):
|
||||||
|
|
||||||
mvd = MultiValueDict({'baz': ['bar1', 'bar2']})
|
mvd = MultiValueDict({'baz': ['bar1', 'bar2']})
|
||||||
assert empty == self.field.get_value(mvd)
|
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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user