viewflow / django-material

Material Design for Django
http://viewflow.io/
BSD 3-Clause "New" or "Revised" License
2.49k stars 425 forks source link

Access to parent field through __ does not work #498

Open robertkowalski1974 opened 3 years ago

robertkowalski1974 commented 3 years ago

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 commented 3 years ago

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