33from django .db .models import Model
44from django .db .models .query import QuerySet
55from django .db .models .manager import Manager
6- from django .utils import six
76from rest_framework import generics
87from rest_framework .response import Response
98from rest_framework .exceptions import NotFound , MethodNotAllowed
109from rest_framework .reverse import reverse
1110
1211from rest_framework_json_api .exceptions import Conflict
1312from rest_framework_json_api .serializers import ResourceIdentifierObjectSerializer
14- from rest_framework_json_api .utils import format_relation_name , get_resource_type_from_instance , OrderedDict
13+ from rest_framework_json_api .utils import format_relation_name , get_resource_type_from_instance , OrderedDict , Hyperlink
1514
1615
1716class RelationshipView (generics .GenericAPIView ):
@@ -34,23 +33,6 @@ def get_url(self, name, view_name, kwargs, request):
3433 attributes are not configured to correctly match the URL conf.
3534 """
3635
37- class Hyperlink (six .text_type ):
38- """
39- A string like object that additionally has an associated name.
40- We use this for hyperlinked URLs that may render as a named link
41- in some contexts, or render as a plain URL in others.
42-
43- Comes from Django REST framework 3.2
44- https://github.com/tomchristie/django-rest-framework
45- """
46-
47- def __new__ (self , url , name ):
48- ret = six .text_type .__new__ (self , url )
49- ret .name = name
50- return ret
51-
52- is_hyperlink = True
53-
5436 # Return None if the view name is not supplied
5537 if not view_name :
5638 return None
0 commit comments