Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Access to parent field through __ does not work #498

Open
robertkowalski1974 opened this issue Feb 15, 2021 · 1 comment
Open

Access to parent field through __ does not work #498

robertkowalski1974 opened this issue Feb 15, 2021 · 1 comment

Comments

@robertkowalski1974
Copy link

In One to Many relations I was accessing Parent fields with __.
For example if Child had Parent then I can have:

list_display =['Parent__ParentField']

This does not seem to be working with django-material ModelViewSet

@kmmbvnr
Copy link
Collaborator

kmmbvnr commented Apr 13, 2021

Yep, looks like it's requires to fix lookup procedure. I hope i would add this ti 2.0 only.

Currently this can be overcome by using custom method

    def parentfield(self, obj):
        return obj.parent.parentfield

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

No branches or pull requests

2 participants