diff --git a/example/views.py b/example/views.py index 5982e09e..c8dddc50 100644 --- a/example/views.py +++ b/example/views.py @@ -12,9 +12,11 @@ class BlogViewSet(viewsets.ModelViewSet): class EntryViewSet(viewsets.ModelViewSet): queryset = Entry.objects.all() - serializer_class = EntrySerializer resource_name = 'posts' + def get_serializer_class(self): + return EntrySerializer + class AuthorViewSet(viewsets.ModelViewSet): queryset = Author.objects.all() diff --git a/rest_framework_json_api/serializers.py b/rest_framework_json_api/serializers.py index f68d984e..adfc4f0b 100644 --- a/rest_framework_json_api/serializers.py +++ b/rest_framework_json_api/serializers.py @@ -94,7 +94,7 @@ def validate_path(serializer_class, field_path, path): included_resources = include_resources_param.split(',') for included_field_name in included_resources: included_field_path = included_field_name.split('.') - this_serializer_class = view.serializer_class + this_serializer_class = view.get_serializer_class() # lets validate the current path validate_path(this_serializer_class, included_field_path, included_field_name)