django-nested-inline icon indicating copy to clipboard operation
django-nested-inline copied to clipboard

get_readonly_fields does not have proper obj

Open ppython opened this issue 8 years ago • 0 comments
trafficstars

The get_readonly_fields of a nested inline does not have the proper obj passed:

Consider the following configuration:

class SecondLevelInline(NestedStackedInline):
    model = SecondLevelModel

    def get_readonly_fields(self, request, obj=None):
        # obj is a "FirstLevelModel" instead of a "SecondLevelModel"


class FirstLevelInline(NestedStackedInline):
    model = FirstLevelModel
    inlines = [SecondLevelInline, ]

So i cannot make a conditional readonly_fields for my SecondLevelModel and I should have access to an instance of a SecondLevelModel.

ppython avatar Jun 06 '17 16:06 ppython