Skip to content

SerializerMethodResourceRelatedField breaks parent chain #780

Closed
@glowka

Description

@glowka

If SerializerMethodResourceRelatedField is called with many=True and creates child field it misses call to bind() which would complete setting the relation between parent field and child field.

In effect it breaks the pattern that on every DRF field you can always go up the tree towards the root using parent attribute.

That part of ManyRelatedField.init() is missing:

class ManyRelatedField:
    ...
    def __init__(self, child_relation=None, *args, **kwargs):
        self.child_relation = child_relation
        ...
        self.child_relation.bind(field_name='', parent=self)

I am aware that there are some issues related to SerializerMethodResourceRelatedField already reported in #639, but since this bug is completely independent thing, I report it as separate issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions