Skip to content

Supposedly overridable methods are actually static #299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
arielpontes opened this issue Nov 17, 2016 · 0 comments
Closed

Supposedly overridable methods are actually static #299

arielpontes opened this issue Nov 17, 2016 · 0 comments

Comments

@arielpontes
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant