Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Viewset list when using polymorphic models #400

Closed
@adsized

Description

@adsized

I have been trying to get the support for polymorphic model serialization to work in my latest project. When I request a specific object from my endpoint, the correct serializer is clearly instantiated and I receive the output that I would expect. When I try and retrieve a list of model instances, however, the following exception is raised:


Request Method: GET
Request URL: http://localhost:8000/projects
Django Version: 1.11
Exception Type: AttributeError
Exception Value: 'list' object has no attribute '_meta'
Exception Location: django-rest-framework-json-api/rest_framework_json_api/serializers.py in get_polymorphic_serializer_for_instance, line 279

I have tried running the example project, provided in the repo, and I'm able to reproduce the error I have been seeing.

Looking in the documentation, it is not clear whether there is currently support for serializing multiple model instances in a viewset list output. Looking at the tests for the project, I also do not see a test for this scenario.

Is this something that should be supported?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions