django-nested-inline
django-nested-inline copied to clipboard
get_readonly_fields does not have proper obj
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.