Skip to content

Commit 0d78f7f

Browse files
committed
dropped format_relation_name from wrapping get_resource_type*
This isnt required anymore as the get_resource_type calls handle this
1 parent 1adac02 commit 0d78f7f

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

‎rest_framework_json_api/relations.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from django.utils.translation import ugettext_lazy as _
66

77
from rest_framework_json_api.exceptions import Conflict
8-
from rest_framework_json_api.utils import format_relation_name, Hyperlink, \
8+
from rest_framework_json_api.utils import Hyperlink, \
99
get_resource_type_from_queryset, get_resource_type_from_instance
1010

1111

@@ -137,7 +137,7 @@ def to_representation(self, value):
137137
else:
138138
pk = value.pk
139139

140-
return OrderedDict([('type', format_relation_name(get_resource_type_from_instance(value))), ('id', str(pk))])
140+
return OrderedDict([('type', get_resource_type_from_instance(value)), ('id', str(pk))])
141141

142142
@property
143143
def choices(self):

‎rest_framework_json_api/serializers.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
from rest_framework.serializers import *
44

55
from rest_framework_json_api.relations import ResourceRelatedField
6-
from rest_framework_json_api.utils import format_relation_name, get_resource_type_from_instance, \
7-
get_resource_type_from_serializer, get_included_serializers
6+
from rest_framework_json_api.utils import (
7+
get_resource_type_from_model, get_resource_type_from_instance,
8+
get_resource_type_from_serializer, get_included_serializers)
89

910

1011
class ResourceIdentifierObjectSerializer(BaseSerializer):
@@ -24,7 +25,7 @@ def __init__(self, *args, **kwargs):
2425

2526
def to_representation(self, instance):
2627
return {
27-
'type': format_relation_name(get_resource_type_from_instance(instance)),
28+
'type': get_resource_type_from_instance(instance),
2829
'id': str(instance.pk)
2930
}
3031

‎rest_framework_json_api/views.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from rest_framework_json_api.exceptions import Conflict
1414
from rest_framework_json_api.serializers import ResourceIdentifierObjectSerializer
15-
from rest_framework_json_api.utils import format_relation_name, get_resource_type_from_instance, OrderedDict, Hyperlink
15+
from rest_framework_json_api.utils import get_resource_type_from_instance, OrderedDict, Hyperlink
1616

1717

1818
class RelationshipView(generics.GenericAPIView):
@@ -154,7 +154,7 @@ def _instantiate_serializer(self, instance):
154154
def get_resource_name(self):
155155
if not hasattr(self, '_resource_name'):
156156
instance = getattr(self.get_object(), self.kwargs['related_field'])
157-
self._resource_name = format_relation_name(get_resource_type_from_instance(instance))
157+
self._resource_name = get_resource_type_from_instance(instance)
158158
return self._resource_name
159159

160160
def set_resource_name(self, value):

0 commit comments

Comments
 (0)