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

Supposedly overridable methods are actually static #299

Closed
@arielpontes

Description

@arielpontes

According to the API section of the documentation, "The JSONRenderer exposes a number of methods that you may override if you need highly custom rendering control." However, many of these methods are actually static and there are hardcoded calls to them in the code, making them unoverridable. For example:

@staticmethod
def extract_relationships(fields, resource, resource_instance):
    # Avoid circular deps
    from rest_framework_json_api.relations import ResourceRelatedField
    # ...

@staticmethod
def build_json_resource_obj(fields, resource, resource_instance, resource_name):
    # ...
    relationships = JSONRenderer.extract_relationships(fields, resource, resource_instance)

Shouldn't these be classmethods instead?

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